MediaWiki
REL1_24
|
00001 <?php 00002 00003 class ArticleTest extends MediaWikiTestCase { 00004 00008 private $title; 00012 private $article; 00013 00015 protected function setUp() { 00016 parent::setUp(); 00017 $this->title = Title::makeTitle( NS_MAIN, 'SomePage' ); 00018 $this->article = new Article( $this->title ); 00019 } 00020 00022 protected function tearDown() { 00023 parent::tearDown(); 00024 $this->title = null; 00025 $this->article = null; 00026 } 00027 00031 public function testImplementsGetMagic() { 00032 $this->assertEquals( false, $this->article->mLatest, "Article __get magic" ); 00033 } 00034 00039 public function testImplementsSetMagic() { 00040 $this->article->mLatest = 2; 00041 $this->assertEquals( 2, $this->article->mLatest, "Article __set magic" ); 00042 } 00043 00048 public function testImplementsCallMagic() { 00049 $this->article->mLatest = 33; 00050 $this->article->mDataLoaded = true; 00051 $this->assertEquals( 33, $this->article->getLatest(), "Article __call magic" ); 00052 } 00053 00058 public function testGetOrSetOnNewProperty() { 00059 $this->article->ext_someNewProperty = 12; 00060 $this->assertEquals( 12, $this->article->ext_someNewProperty, 00061 "Article get/set magic on new field" ); 00062 00063 $this->article->ext_someNewProperty = -8; 00064 $this->assertEquals( -8, $this->article->ext_someNewProperty, 00065 "Article get/set magic on update to new field" ); 00066 } 00067 00078 public function testStaticFunctions() { 00079 $this->hideDeprecated( 'Article::selectFields' ); 00080 $this->hideDeprecated( 'Article::getAutosummary' ); 00081 $this->hideDeprecated( 'WikiPage::getAutosummary' ); 00082 $this->hideDeprecated( 'CategoryPage::getAutosummary' ); // Inherited from Article 00083 00084 $this->assertEquals( WikiPage::selectFields(), Article::selectFields(), 00085 "Article static functions" ); 00086 $this->assertEquals( true, is_callable( "Article::onArticleCreate" ), 00087 "Article static functions" ); 00088 $this->assertEquals( true, is_callable( "Article::onArticleDelete" ), 00089 "Article static functions" ); 00090 $this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ), 00091 "Article static functions" ); 00092 $this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ), 00093 "Article static functions" ); 00094 } 00095 }