r73961 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73960‎ | r73961 | r73962 >
Date:17:39, 29 September 2010
Author:demon
Status:ok (Comments)
Tags:
Comment:
Mark test incomplete if Main Page only has one author like on my install
Modified paths:
  • /trunk/phase3/maintenance/tests/phpunit/includes/api/ApiWatchTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit/includes/api/ApiWatchTest.php
@@ -173,13 +173,18 @@
174174 $key = array_pop( $keys );
175175 $pageinfo = $data[0]['query']['pages'][$key]['revisions'][0];
176176
177 - $data = $this->doApiRequest( array(
178 - 'action' => 'rollback',
179 - 'title' => 'Main Page',
180 - 'user' => self::$userName,
181 - 'token' => $pageinfo['rollbacktoken'],
182 - 'watchlist' => 'watch' ), $data );
183 -
 177+ try {
 178+ $data = $this->doApiRequest( array(
 179+ 'action' => 'rollback',
 180+ 'title' => 'Main Page',
 181+ 'user' => self::$userName,
 182+ 'token' => $pageinfo['rollbacktoken'],
 183+ 'watchlist' => 'watch' ), $data );
 184+ } catch( UsageException $ue ) {
 185+ if( $ue->getCodeString() == 'onlyauthor' ) {
 186+ $this->markTestIncomplete( "Only one author to 'Main Page', cannot test rollback" );
 187+ }
 188+ }
184189 $this->assertArrayHasKey( 'rollback', $data[0] );
185190 $this->assertArrayHasKey( 'title', $data[0]['rollback'] );
186191 }

Comments

#Comment by Hashar (talk | contribs)   08:05, 17 October 2010

Marking fixme.

Handling the exception is great, but to actually test rollback : - add ghosts revisions to the Main_Page title - test rollback on a create apage with several revisions

This will probably qualify the test as 'destructive'

#Comment by P858snake (talk | contribs)   08:08, 17 October 2010

I think by the looks this is only meant to test if roll back is possible in the page's current state, and when there is only one revision it is not possible.

#Comment by Hashar (talk | contribs)   20:06, 7 December 2010

ok with exception handling

Status & tagging log