Mark test incomplete if Main Page only has one author like on my install
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 29 Sep 2010 17:39:06 +0000 (17:39 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 29 Sep 2010 17:39:06 +0000 (17:39 +0000)
maintenance/tests/phpunit/includes/api/ApiWatchTest.php

index ad6824e..7477a89 100644 (file)
@@ -173,13 +173,18 @@ class ApiWatchTest extends ApiTestSetup {
                $key = array_pop( $keys );
                $pageinfo = $data[0]['query']['pages'][$key]['revisions'][0];
 
-               $data = $this->doApiRequest( array(
-                       'action' => 'rollback',
-                       'title' => 'Main Page',
-                       'user' => self::$userName,
-                       'token' => $pageinfo['rollbacktoken'],
-                       'watchlist' => 'watch' ), $data );
-
+               try {
+                       $data = $this->doApiRequest( array(
+                               'action' => 'rollback',
+                               'title' => 'Main Page',
+                               'user' => self::$userName,
+                               'token' => $pageinfo['rollbacktoken'],
+                               'watchlist' => 'watch' ), $data );
+               } catch( UsageException $ue ) {
+                       if( $ue->getCodeString() == 'onlyauthor' ) {
+                               $this->markTestIncomplete( "Only one author to 'Main Page', cannot test rollback" );
+                       }
+               }
                $this->assertArrayHasKey( 'rollback', $data[0] );
                $this->assertArrayHasKey( 'title', $data[0]['rollback'] );
        }