3 class ArticleTest
extends MediaWikiTestCase
{
14 /** creates a title object and its article object */
15 protected function setUp() {
17 $this->title
= Title
::makeTitle( NS_MAIN
, 'SomePage' );
18 $this->article
= new Article( $this->title
);
21 /** cleanup title object and its article object */
22 protected function tearDown() {
25 $this->article
= null;
29 * @covers Article::__get
31 public function testImplementsGetMagic() {
32 $this->assertEquals( false, $this->article
->mLatest
, "Article __get magic" );
36 * @depends testImplementsGetMagic
37 * @covers Article::__set
39 public function testImplementsSetMagic() {
40 $this->article
->mLatest
= 2;
41 $this->assertEquals( 2, $this->article
->mLatest
, "Article __set magic" );
45 * @covers Article::__get
46 * @covers Article::__set
48 public function testGetOrSetOnNewProperty() {
49 $this->article
->ext_someNewProperty
= 12;
50 $this->assertEquals( 12, $this->article
->ext_someNewProperty
,
51 "Article get/set magic on new field" );
53 $this->article
->ext_someNewProperty
= -8;
54 $this->assertEquals( -8, $this->article
->ext_someNewProperty
,
55 "Article get/set magic on update to new field" );
59 * Checks for the existence of the backwards compatibility static functions
60 * (forwarders to WikiPage class)
62 * @covers Article::selectFields
63 * @covers Article::onArticleCreate
64 * @covers Article::onArticleDelete
65 * @covers Article::onArticleEdit
66 * @covers Article::getAutosummary
68 public function testStaticFunctions() {
69 $this->hideDeprecated( 'Article::selectFields' );
70 $this->hideDeprecated( 'Article::getAutosummary' );
71 $this->hideDeprecated( 'WikiPage::getAutosummary' );
72 $this->hideDeprecated( 'CategoryPage::getAutosummary' ); // Inherited from Article
74 $this->assertEquals( WikiPage
::selectFields(), Article
::selectFields(),
75 "Article static functions" );
76 $this->assertEquals( true, is_callable( "Article::onArticleCreate" ),
77 "Article static functions" );
78 $this->assertEquals( true, is_callable( "Article::onArticleDelete" ),
79 "Article static functions" );
80 $this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ),
81 "Article static functions" );
82 $this->assertTrue( is_string( CategoryPage
::getAutosummary( '', '', 0 ) ),
83 "Article static functions" );