Add BlockTest unit test
authorX! <soxred93@users.mediawiki.org>
Tue, 28 Dec 2010 19:12:27 +0000 (19:12 +0000)
committerX! <soxred93@users.mediawiki.org>
Tue, 28 Dec 2010 19:12:27 +0000 (19:12 +0000)
tests/phpunit/includes/BlockTest.php [new file with mode: 0644]

diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php
new file mode 100644 (file)
index 0000000..a4ae047
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+class BlockTest extends MediaWikiTestCase {
+       
+       private $block;
+       
+       function setUp() {
+               global $wgContLang;
+               $wgContLang = Language::factory( 'en' );
+       }
+
+       function tearDown() {
+       }
+       
+       function addDBData() {
+               $user = User::newFromName( 'UTBlockee' );
+               $user->addToDatabase();
+               $user->setPassword( 'UTBlockeePassword' );
+                       
+               $user->saveSettings();
+               
+               $this->block = new Block( 'UTBlockee', 1, 0,
+                       'Parce que', wfTimestampNow()
+               );
+
+               $this->block->insert();
+       }
+       
+       function testInitializerFunctionsReturnCorrectBlock() {
+               
+               $this->assertTrue( $this->block->equals( Block::newFromDB('UTBlockee') ), "newFromDB() returns the same block as the one that was made");
+               
+               $this->assertTrue( $this->block->equals( Block::newFromID( 1 ) ), "newFromID() returns the same block as the one that was made");
+               
+       }
+
+}
+