diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
commit | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch) | |
tree | ec04cc15b867bc21eedca904cea9af0254531a11 /tests/phpunit/includes/ArticleTest.php | |
parent | a22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff) |
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook
* Use only css to hide our menu bar when printing
Diffstat (limited to 'tests/phpunit/includes/ArticleTest.php')
-rw-r--r-- | tests/phpunit/includes/ArticleTest.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/phpunit/includes/ArticleTest.php b/tests/phpunit/includes/ArticleTest.php new file mode 100644 index 00000000..285efee9 --- /dev/null +++ b/tests/phpunit/includes/ArticleTest.php @@ -0,0 +1,82 @@ +<?php + +class ArticleTest extends MediaWikiTestCase { + + private $title; // holds a Title object + private $article; // holds an article + + /** creates a title object and its article object */ + function setUp() { + $this->title = Title::makeTitle( NS_MAIN, 'SomePage' ); + $this->article = new Article( $this->title ); + + } + + /** cleanup title object and its article object */ + function tearDown() { + $this->title = null; + $this->article = null; + + } + + function testImplementsGetMagic() { + $this->assertEquals( -1, $this->article->mCounter, "Article __get magic" ); + } + + /** + * @depends testImplementsGetMagic + */ + function testImplementsSetMagic() { + + $this->article->mCounter = 2; + $this->assertEquals( 2, $this->article->mCounter, "Article __set magic" ); + } + + /** + * @depends testImplementsSetMagic + */ + function testImplementsCallMagic() { + $this->article->mCounter = 33; + $this->assertEquals( 33, $this->article->getCount(), "Article __call magic" ); + } + + function testGetOrSetOnNewProperty() { + $this->article->ext_someNewProperty = 12; + $this->assertEquals( 12, $this->article->ext_someNewProperty, + "Article get/set magic on new field" ); + + $this->article->ext_someNewProperty = -8; + $this->assertEquals( -8, $this->article->ext_someNewProperty, + "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( true, is_callable( "Article::onArticleCreate" ), + "Article static functions" ); + $this->assertEquals( true, is_callable( "Article::onArticleDelete" ), + "Article static functions" ); + $this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ), + "Article static functions" ); + $this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ), + "Article static functions" ); + } + + function testWikiPageFactory() { + $title = Title::makeTitle( NS_FILE, 'Someimage.png' ); + $page = WikiPage::factory( $title ); + $this->assertEquals( 'WikiFilePage', get_class( $page ) ); + + $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory' ); + $page = WikiPage::factory( $title ); + $this->assertEquals( 'WikiCategoryPage', get_class( $page ) ); + + $title = Title::makeTitle( NS_MAIN, 'SomePage' ); + $page = WikiPage::factory( $title ); + $this->assertEquals( 'WikiPage', get_class( $page ) ); + } +} |