r79125 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79124‎ | r79125 | r79126 >
Date:19:12, 28 December 2010
Author:soxred93
Status:ok
Tags:
Comment:
Add BlockTest unit test
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/BlockTest.php (added) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/BlockTest.php
@@ -0,0 +1,38 @@
 2+<?php
 3+
 4+class BlockTest extends MediaWikiTestCase {
 5+
 6+ private $block;
 7+
 8+ function setUp() {
 9+ global $wgContLang;
 10+ $wgContLang = Language::factory( 'en' );
 11+ }
 12+
 13+ function tearDown() {
 14+ }
 15+
 16+ function addDBData() {
 17+ $user = User::newFromName( 'UTBlockee' );
 18+ $user->addToDatabase();
 19+ $user->setPassword( 'UTBlockeePassword' );
 20+
 21+ $user->saveSettings();
 22+
 23+ $this->block = new Block( 'UTBlockee', 1, 0,
 24+ 'Parce que', wfTimestampNow()
 25+ );
 26+
 27+ $this->block->insert();
 28+ }
 29+
 30+ function testInitializerFunctionsReturnCorrectBlock() {
 31+
 32+ $this->assertTrue( $this->block->equals( Block::newFromDB('UTBlockee') ), "newFromDB() returns the same block as the one that was made");
 33+
 34+ $this->assertTrue( $this->block->equals( Block::newFromID( 1 ) ), "newFromID() returns the same block as the one that was made");
 35+
 36+ }
 37+
 38+}
 39+

Status & tagging log