r99984 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99983‎ | r99984 | r99985 >
Date:22:18, 16 October 2011
Author:nelson
Status:resolved (Comments)
Tags:
Comment:
StoreBatchTest counts now correct, and using assertEquals
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/filerepo/StoreBatchTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/filerepo/StoreBatchTest.php
@@ -54,8 +54,8 @@
5555 private function storecohort($fn, $infn, $otherfn, $fromrepo) {
5656 $f = $this->storeit( $fn, $infn, 0 );
5757 $this->assertTrue( $f->isOK(), 'failed to store a new file' );
58 - $this->assertTrue( $f->failCount == 0, "counts wrong {$f->successCount} {$f->failCount}" );
59 - $this->assertTrue( $f->successCount == 1 , "counts wrong {$f->successCount} {$f->failCount}" );
 58+ $this->assertEquals( $f->failCount, 0, "counts wrong {$f->successCount} {$f->failCount}" );
 59+ $this->assertEquals( $f->successCount, 1 , "counts wrong {$f->successCount} {$f->failCount}" );
6060 if ( $fromrepo ) {
6161 $f = $this->storeit( "Other-$fn", $infn, FileRepo::OVERWRITE);
6262 $infn = $f->value;
@@ -63,18 +63,18 @@
6464 // This should work because we're allowed to overwrite
6565 $f = $this->storeit( $fn, $infn, FileRepo::OVERWRITE );
6666 $this->assertTrue( $f->isOK(), 'We should be allowed to overwrite' );
67 - $this->assertTrue( $f->failCount == 0, "counts wrong {$f->successCount} {$f->failCount}" );
68 - $this->assertTrue( $f->successCount == 1 , "counts wrong {$f->successCount} {$f->failCount}" );
 67+ $this->assertEquals( $f->failCount, 0, "counts wrong {$f->successCount} {$f->failCount}" );
 68+ $this->assertEquals( $f->successCount, 1 , "counts wrong {$f->successCount} {$f->failCount}" );
6969 // This should fail because we're overwriting.
7070 $f = $this->storeit( $fn, $infn, 0 );
7171 $this->assertFalse( $f->isOK(), 'We should not be allowed to overwrite' );
72 - #$this->assertTrue( $f->failCount == 0, "counts wrong {$f->successCount} {$f->failCount}" );
73 - #$this->assertTrue( $f->successCount == 0 , "counts wrong {$f->successCount} {$f->failCount}" );
 72+ $this->assertEquals( $f->failCount, 1, "counts wrong {$f->successCount} {$f->failCount}" );
 73+ $this->assertEquals( $f->successCount, 0 , "counts wrong {$f->successCount} {$f->failCount}" );
7474 // This should succeed because we're overwriting the same content.
7575 $f = $this->storeit( $fn, $infn, FileRepo::OVERWRITE_SAME );
7676 $this->assertTrue( $f->isOK(), 'We should be able to overwrite the same content' );
77 - $this->assertTrue( $f->failCount == 0, "counts wrong {$f->successCount} {$f->failCount}" );
78 - $this->assertTrue( $f->successCount == 1 , "counts wrong {$f->successCount} {$f->failCount}" );
 77+ $this->assertEquals( $f->failCount, 0, "counts wrong {$f->successCount} {$f->failCount}" );
 78+ $this->assertEquals( $f->successCount, 1 , "counts wrong {$f->successCount} {$f->failCount}" );
7979 // This should fail because we're overwriting different content.
8080 if ( $fromrepo ) {
8181 $f = $this->storeit( "Other-$fn", $otherfn, FileRepo::OVERWRITE);
@@ -82,8 +82,8 @@
8383 }
8484 $f = $this->storeit( $fn, $otherfn, FileRepo::OVERWRITE_SAME );
8585 $this->assertFalse( $f->isOK(), 'We should not be allowed to overwrite different content' );
86 - #$this->assertTrue( $f->failCount == 0, "counts wrong {$f->successCount} {$f->failCount}" );
87 - #$this->assertTrue( $f->successCount == 0 , "counts wrong {$f->successCount} {$f->failCount}" );
 86+ $this->assertEquals( $f->failCount, 1, "counts wrong {$f->successCount} {$f->failCount}" );
 87+ $this->assertEquals( $f->successCount, 0 , "counts wrong {$f->successCount} {$f->failCount}" );
8888 }
8989
9090 public function teststore() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r100003StoreBatchTest counts even MORE correct than before.nelson23:03, 16 October 2011

Comments

#Comment by Reedy (talk | contribs)   22:28, 16 October 2011
StoreBatchTest::teststore
counts wrong 0 0
Failed asserting that <integer:1> matches expected <integer:0>.

/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/includes/filerepo/StoreBatchTest.php:71
/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/includes/filerepo/StoreBatchTest.php:91
/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/MediaWikiTestCase.php:64
/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/MediaWikiPHPUnitCommand.php:31
/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/phpunit.php:60
#Comment by RussNelson (talk | contribs)   23:04, 16 October 2011

Dang! Fixed in r100003

Status & tagging log