3 class MWDebugTest
extends MediaWikiTestCase
{
7 // Make sure MWDebug class is enabled
8 static $MWDebugEnabled = false;
9 if( !$MWDebugEnabled ) {
11 $MWDebugEnabled = true;
16 /** Clear log before each test */
23 function testAddLog() {
24 MWDebug
::log( 'logging a string' );
25 $this->assertEquals( array( array(
26 'msg' => 'logging a string',
28 'caller' => __METHOD__
,
37 function testAddWarning() {
38 MWDebug
::warning( 'Warning message' );
39 $this->assertEquals( array( array(
40 'msg' => 'Warning message',
42 'caller' => 'MWDebug::warning',
49 * Broken on gallium which use an old PHPUnit version
52 function testAvoidDuplicateDeprecations() {
53 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
54 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
56 $this->assertCount( 1,
58 "Only one deprecated warning per function should be kept"
63 * Broken on gallium which use an old PHPUnit version
66 function testAvoidNonConsecutivesDuplicateDeprecations() {
67 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
68 MWDebug
::warning( 'some warning' );
69 MWDebug
::log( 'we could have logged something too' );
70 // Another deprecation
71 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
73 $this->assertCount( 3,
75 "Only one deprecated warning per function should be kept"