r105833 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105832‎ | r105833 | r105834 >
Date:21:49, 11 December 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Attempt to fix tests broken by r105828

Test wanted in a specific order, now just look up wanted array key from title row

Untested as my phpunit tests seem to be b0rked locally :(
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/api/ApiPurgeTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/api/ApiPurgeTest.php
@@ -9,33 +9,25 @@
1010 parent::setUp();
1111 $this->doLogin();
1212 }
13 -
 13+
1414 function testPurgeMainPage() {
15 -
1615 if ( !Title::newFromText( 'UTPage' )->exists() ) {
1716 $this->markTestIncomplete( "The article [[UTPage]] does not exist" );
1817 }
19 -
 18+
2019 $somePage = mt_rand();
2120
2221 $data = $this->doApiRequest( array(
2322 'action' => 'purge',
2423 'titles' => 'UTPage|' . $somePage . '|%5D' ) );
25 -
 24+
2625 $this->assertArrayHasKey( 'purge', $data[0] );
27 -
28 - $this->assertArrayHasKey( 0, $data[0]['purge'] );
29 - $this->assertArrayHasKey( 'purged', $data[0]['purge'][0] );
30 - $this->assertEquals( 'UTPage', $data[0]['purge'][0]['title'] );
31 -
32 - $this->assertArrayHasKey( 1, $data[0]['purge'] );
33 - $this->assertArrayHasKey( 'missing', $data[0]['purge'][1] );
34 - $this->assertEquals( $somePage, $data[0]['purge'][1]['title'] );
35 -
36 - $this->assertArrayHasKey( 2, $data[0]['purge'] );
37 - $this->assertArrayHasKey( 'invalid', $data[0]['purge'][2] );
38 - $this->assertEquals( '%5D', $data[0]['purge'][2]['title'] );
39 -
 26+ $this->assertEquals( 3, count( $data[0]['purge'] ) );
 27+
 28+ $pages = array( 'UTPage' => 'purged', $somePage => 'missing', '%5D' => 'invalid' );
 29+ foreach( $data[0]['purge'] as $v ) {
 30+ $this->assertArrayHasKey( $pages[$v['title']], $v );
 31+ }
4032 }
4133
4234 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r105834Mark testPurgeMainPage broken after r105828 and r105833...reedy22:39, 11 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105828* (bug 32495) API should allow purge by pageids....reedy20:43, 11 December 2011

Comments

#Comment by Reedy (talk | contribs)   23:51, 11 December 2011

Still apparently broken on CI but not locally.

Gah.

#Comment by Catrope (talk | contribs)   16:44, 15 December 2011

This also doesn't assert the value is correct.

#Comment by Reedy (talk | contribs)   17:23, 15 December 2011

Value of what?

Status & tagging log