aboutsummaryrefslogtreecommitdiffstats
path: root/tests/GlobalTest.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@users.mediawiki.org>2007-06-06 18:37:35 +0000
committerBrion Vibber <brion@users.mediawiki.org>2007-06-06 18:37:35 +0000
commit1bf3f2493e4bd494f523e67adb0e52c1b1ed582d (patch)
treea7d50bbb78c66c9308018320927d9289745c7022 /tests/GlobalTest.php
parentb08f93c1db31680572847c7b8d167e38919dbea1 (diff)
downloadmediawikicore-1bf3f2493e4bd494f523e67adb0e52c1b1ed582d.tar.gz
mediawikicore-1bf3f2493e4bd494f523e67adb0e52c1b1ed582d.zip
Update test cases to run
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/22801
Diffstat (limited to 'tests/GlobalTest.php')
-rw-r--r--tests/GlobalTest.php33
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/GlobalTest.php b/tests/GlobalTest.php
index e15556e0da19..6aef6e483c5c 100644
--- a/tests/GlobalTest.php
+++ b/tests/GlobalTest.php
@@ -1,6 +1,21 @@
<?php
class GlobalTest extends PHPUnit_Framework_TestCase {
+ function setUp() {
+ global $wgReadOnlyFile;
+ $this->originals['wgReadOnlyFile'] = $wgReadOnlyFile;
+ $wgReadOnlyFile = tempnam(wfTempDir(), "mwtest_readonly");
+ unlink( $wgReadOnlyFile );
+ }
+
+ function tearDown() {
+ global $wgReadOnlyFile;
+ if( file_exists( $wgReadOnlyFile ) ) {
+ unlink( $wgReadOnlyFile );
+ }
+ $wgReadOnlyFile = $this->originals['wgReadOnlyFile'];
+ }
+
function testRandom() {
# This could hypothetically fail, but it shouldn't ;)
$this->assertFalse(
@@ -14,16 +29,28 @@ class GlobalTest extends PHPUnit_Framework_TestCase {
}
function testReadOnlyEmpty() {
+ global $wgReadOnly;
+ $wgReadOnly = null;
+
+ $this->assertFalse( wfReadOnly() );
$this->assertFalse( wfReadOnly() );
}
function testReadOnlySet() {
- $f = fopen( $GLOBALS['wgReadOnlyFile'], "wt" );
+ global $wgReadOnly, $wgReadOnlyFile;
+
+ $f = fopen( $wgReadOnlyFile, "wt" );
fwrite( $f, 'Message' );
fclose( $f );
+ $wgReadOnly = null;
+
+ $this->assertTrue( wfReadOnly() );
$this->assertTrue( wfReadOnly() );
- unlink( $GLOBALS['wgReadOnlyFile'] );
+ unlink( $wgReadOnlyFile );
+ $wgReadOnly = null;
+
+ $this->assertFalse( wfReadOnly() );
$this->assertFalse( wfReadOnly() );
}
@@ -35,7 +62,7 @@ class GlobalTest extends PHPUnit_Framework_TestCase {
function testTime() {
$start = wfTime();
- $this->assertType( 'double', $start );
+ $this->assertType( 'float', $start );
$end = wfTime();
$this->assertTrue( $end > $start, "Time is running backwards!" );
}