From f40558d530f6e4a7e3c8f06ae8fdab2c46f18bf9 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 29 Sep 2010 17:39:06 +0000 Subject: [PATCH] Mark test incomplete if Main Page only has one author like on my install --- .../phpunit/includes/api/ApiWatchTest.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/maintenance/tests/phpunit/includes/api/ApiWatchTest.php b/maintenance/tests/phpunit/includes/api/ApiWatchTest.php index ad6824e434..7477a8944e 100644 --- a/maintenance/tests/phpunit/includes/api/ApiWatchTest.php +++ b/maintenance/tests/phpunit/includes/api/ApiWatchTest.php @@ -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'] ); } -- 2.20.1