ArticleTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. class ArticleTest extends MediaWikiTestCase {
  3. /**
  4. * @var Title
  5. */
  6. private $title;
  7. /**
  8. * @var Article
  9. */
  10. private $article;
  11. /** creates a title object and its article object */
  12. protected function setUp() {
  13. parent::setUp();
  14. $this->title = Title::makeTitle( NS_MAIN, 'SomePage' );
  15. $this->article = new Article( $this->title );
  16. }
  17. /** cleanup title object and its article object */
  18. protected function tearDown() {
  19. parent::tearDown();
  20. $this->title = null;
  21. $this->article = null;
  22. }
  23. /**
  24. * @covers Article::__get
  25. */
  26. public function testImplementsGetMagic() {
  27. $this->assertEquals( false, $this->article->mLatest, "Article __get magic" );
  28. }
  29. /**
  30. * @depends testImplementsGetMagic
  31. * @covers Article::__set
  32. */
  33. public function testImplementsSetMagic() {
  34. $this->article->mLatest = 2;
  35. $this->assertEquals( 2, $this->article->mLatest, "Article __set magic" );
  36. }
  37. /**
  38. * @covers Article::__get
  39. * @covers Article::__set
  40. */
  41. public function testGetOrSetOnNewProperty() {
  42. $this->article->ext_someNewProperty = 12;
  43. $this->assertEquals( 12, $this->article->ext_someNewProperty,
  44. "Article get/set magic on new field" );
  45. $this->article->ext_someNewProperty = -8;
  46. $this->assertEquals( -8, $this->article->ext_someNewProperty,
  47. "Article get/set magic on update to new field" );
  48. }
  49. }