28fe3c0925380595d60c2b6e7aad2316f728223b
3 class BlockTest
extends MediaWikiTestCase
{
5 private $block, $madeAt;
9 $wgContLang = Language
::factory( 'en' );
15 function addDBData() {
17 $user = User
::newFromName( 'UTBlockee' );
18 if( $user->getID() == 0 ) {
19 $user->addToDatabase();
20 $user->setPassword( 'UTBlockeePassword' );
22 $user->saveSettings();
25 $this->block
= new Block( 'UTBlockee', 1, 0,
28 $this->madeAt
= wfTimestamp( TS_MW
);
30 $this->block
->insert();
33 function testInitializerFunctionsReturnCorrectBlock() {
35 $this->assertTrue( $this->block
->equals( Block
::newFromDB('UTBlockee') ), "newFromDB() returns the same block as the one that was made");
37 $this->assertTrue( $this->block
->equals( Block
::newFromID( 1 ) ), "newFromID() returns the same block as the one that was made");
44 function testBug26425BlockTimestampDefaultsToTime() {
46 $this->assertEquals( $this->madeAt
, $this->block
->mTimestamp
, "If no timestamp is specified, the block is recorded as time()");