From 9d2997825242248d956497a48181f08deeb09194 Mon Sep 17 00:00:00 2001 From: X! Date: Sun, 2 Jan 2011 01:59:52 +0000 Subject: [PATCH] Add some wfDebug() unit tests --- tests/phpunit/includes/GlobalTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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! */ } -- 2.20.1