From: X! Date: Tue, 28 Dec 2010 19:27:34 +0000 (+0000) Subject: Add test to supplement Bug 26425 (followup to r79013) X-Git-Tag: 1.31.0-rc.0~33022 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/voir.php?a=commitdiff_plain;h=c4befaf28c00f7fff90862aa269fac849e5239e7;p=lhc%2Fweb%2Fwiklou.git Add test to supplement Bug 26425 (followup to r79013) --- diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index a4ae047f3b..28fe3c0925 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -2,7 +2,7 @@ class BlockTest extends MediaWikiTestCase { - private $block; + private $block, $madeAt; function setUp() { global $wgContLang; @@ -13,15 +13,19 @@ class BlockTest extends MediaWikiTestCase { } function addDBData() { + $user = User::newFromName( 'UTBlockee' ); - $user->addToDatabase(); - $user->setPassword( 'UTBlockeePassword' ); + if( $user->getID() == 0 ) { + $user->addToDatabase(); + $user->setPassword( 'UTBlockeePassword' ); - $user->saveSettings(); + $user->saveSettings(); + } $this->block = new Block( 'UTBlockee', 1, 0, - 'Parce que', wfTimestampNow() + 'Parce que' ); + $this->madeAt = wfTimestamp( TS_MW ); $this->block->insert(); } @@ -33,6 +37,15 @@ class BlockTest extends MediaWikiTestCase { $this->assertTrue( $this->block->equals( Block::newFromID( 1 ) ), "newFromID() returns the same block as the one that was made"); } + + /** + * per bug 26425 + */ + function testBug26425BlockTimestampDefaultsToTime() { + + $this->assertEquals( $this->madeAt, $this->block->mTimestamp, "If no timestamp is specified, the block is recorded as time()"); + + } }