From: X! Date: Sun, 2 Jan 2011 01:59:52 +0000 (+0000) Subject: Add some wfDebug() unit tests X-Git-Tag: 1.31.0-rc.0~32898 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=9d2997825242248d956497a48181f08deeb09194;p=lhc%2Fweb%2Fwiklou.git Add some wfDebug() unit tests --- diff --git a/tests/phpunit/includes/GlobalTest.php b/tests/phpunit/includes/GlobalTest.php index 07b076d137..1e09f398ca 100644 --- a/tests/phpunit/includes/GlobalTest.php +++ b/tests/phpunit/includes/GlobalTest.php @@ -464,6 +464,32 @@ class GlobalTest extends MediaWikiTestCase { } } + + + function testDebugFunctionTest() { + global $wgDebugLogFile; + + $old_log_file = $wgDebugLogFile; + + $wgDebugLogFile = tempnam( wfTempDir(), 'mw-' ); + + + wfDebug( "This is a normal string" ); + $this->assertEquals( "This is a normal string", file_get_contents( $wgDebugLogFile ) ); + unlink( $wgDebugLogFile ); + + wfDebug( "This is nöt an ASCII string" ); + $this->assertEquals( "This is nöt an ASCII string", file_get_contents( $wgDebugLogFile ) ); + unlink( $wgDebugLogFile ); + + wfDebug( "\00305This has böth UTF and control chars\003" ); + $this->assertEquals( " 05This has böth UTF and control chars ", file_get_contents( $wgDebugLogFile ) ); + unlink( $wgDebugLogFile ); + + + $wgDebugLogFile = $old_log_file; + + } /* TODO: many more! */ }