6 class BlockTest
extends MediaWikiTestCase
{
8 private $block, $madeAt;
12 $wgContLang = Language
::factory( 'en' );
18 function addDBData() {
20 $user = User
::newFromName( 'UTBlockee' );
21 if( $user->getID() == 0 ) {
22 $user->addToDatabase();
23 $user->setPassword( 'UTBlockeePassword' );
25 $user->saveSettings();
28 $this->block
= new Block( 'UTBlockee', 1, 0,
31 $this->madeAt
= wfTimestamp( TS_MW
);
33 $this->block
->insert();
36 function testInitializerFunctionsReturnCorrectBlock() {
38 $this->assertTrue( $this->block
->equals( Block
::newFromDB('UTBlockee') ), "newFromDB() returns the same block as the one that was made");
40 $this->assertTrue( $this->block
->equals( Block
::newFromID( 1 ) ), "newFromID() returns the same block as the one that was made");
47 function testBug26425BlockTimestampDefaultsToTime() {
49 $this->assertEquals( $this->madeAt
, $this->block
->mTimestamp
, "If no timestamp is specified, the block is recorded as time()");