X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FArticleTest.php;h=846d2b86c2c628e53c5c2f2a26f0835f0baf566a;hb=7ccc77a33f120c3e692ba5f24a3e5084119e167a;hp=449851c56b1a694bf940fecd8c2495d76b328a91;hpb=fe623a323b21720074e1ac4ca6c9a8a7dd38e725;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/ArticleTest.php b/tests/phpunit/includes/ArticleTest.php index 449851c56b..846d2b86c2 100644 --- a/tests/phpunit/includes/ArticleTest.php +++ b/tests/phpunit/includes/ArticleTest.php @@ -7,7 +7,7 @@ class ArticleTest extends MediaWikiTestCase { /** creates a title object and its article object */ function setUp() { - $this->title = Title::makeTitle( NS_MAIN, 'somePage' ); + $this->title = Title::makeTitle( NS_MAIN, 'SomePage' ); $this->article = new Article( $this->title ); } @@ -19,25 +19,25 @@ class ArticleTest extends MediaWikiTestCase { } - function testImplementsGetMagic() { - $this->assertEquals( -1, $this->article->mCounter, "Article __get magic" ); + function testImplementsGetMagic() { + $this->assertEquals( false, $this->article->mLatest, "Article __get magic" ); } /** * @depends testImplementsGetMagic */ function testImplementsSetMagic() { - - $this->article->mCounter = 2; - $this->assertEquals( 2, $this->article->mCounter, "Article __set magic" ); + $this->article->mLatest = 2; + $this->assertEquals( 2, $this->article->mLatest, "Article __set magic" ); } /** * @depends testImplementsSetMagic */ function testImplementsCallMagic() { - $this->article->mCounter = 33; - $this->assertEquals( 33, $this->article->getCount(), "Article __call magic" ); + $this->article->mLatest = 33; + $this->article->mDataLoaded = true; + $this->assertEquals( 33, $this->article->getLatest(), "Article __call magic" ); } function testGetOrSetOnNewProperty() { @@ -50,14 +50,17 @@ class ArticleTest extends MediaWikiTestCase { "Article get/set magic on update to new field" ); } + /** + * Checks for the existence of the backwards compatibility static functions (forwarders to WikiPage class) + */ function testStaticFunctions() { $this->assertEquals( WikiPage::selectFields(), Article::selectFields(), "Article static functions" ); - $this->assertEquals( null, Article::onArticleCreate( $this->title ), + $this->assertEquals( true, is_callable( "Article::onArticleCreate" ), "Article static functions" ); - $this->assertEquals( null, Article::onArticleDelete( $this->title ), + $this->assertEquals( true, is_callable( "Article::onArticleDelete" ), "Article static functions" ); - $this->assertEquals( null, ImagePage::onArticleEdit( $this->title ), + $this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ), "Article static functions" ); $this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ), "Article static functions" ); @@ -65,15 +68,15 @@ class ArticleTest extends MediaWikiTestCase { function testWikiPageFactory() { $title = Title::makeTitle( NS_FILE, 'Someimage.png' ); - $page = WikiPageFactory::newFromTitle( $title ); + $page = WikiPage::factory( $title ); $this->assertEquals( 'WikiFilePage', get_class( $page ) ); $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory' ); - $page = WikiPageFactory::newFromTitle( $title ); + $page = WikiPage::factory( $title ); $this->assertEquals( 'WikiCategoryPage', get_class( $page ) ); $title = Title::makeTitle( NS_MAIN, 'SomePage' ); - $page = WikiPageFactory::newFromTitle( $title ); + $page = WikiPage::factory( $title ); $this->assertEquals( 'WikiPage', get_class( $page ) ); } }