3 class MWDebugTest
extends MediaWikiTestCase
{
6 /** Clear log before each test */
10 function testAddLog() {
11 MWDebug
::log( 'logging a string' );
12 $this->assertEquals( array( array(
13 'msg' => 'logging a string',
15 'caller' => __METHOD__
,
21 function testAddWarning() {
22 MWDebug
::warning( 'Warning message' );
23 $this->assertEquals( array( array(
24 'msg' => 'Warning message',
26 'caller' => 'MWDebug::warning',
32 function testAvoidDuplicateDeprecations() {
33 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
34 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
36 $this->assertCount( 1,
38 "Only one deprecated warning per function should be kept"
42 function testAvoidNonConsecutivesDuplicateDeprecations() {
43 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
44 MWDebug
::warning( 'some warning' );
45 MWDebug
::log( 'we could have logged something too' );
46 // Another deprecation
47 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
49 $this->assertCount( 3,
51 "Only one deprecated warning per function should be kept"