Merge "(bug 40302) Lock user table with LOCK TABLES"
[lhc/web/wiklou.git] / tests / phpunit / includes / ArticleTest.php
index 449851c..846d2b8 100644 (file)
@@ -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 ) );
        }
 }