3 class MWDebugTest
extends MediaWikiTestCase
{
6 /** Clear log before each test */
13 function testAddLog() {
14 MWDebug
::log( 'logging a string' );
15 $this->assertEquals( array( array(
16 'msg' => 'logging a string',
18 'caller' => __METHOD__
,
27 function testAddWarning() {
28 MWDebug
::warning( 'Warning message' );
29 $this->assertEquals( array( array(
30 'msg' => 'Warning message',
32 'caller' => 'MWDebug::warning',
39 * Broken on gallium which use an old PHPUnit version
42 function testAvoidDuplicateDeprecations() {
43 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
44 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
46 $this->assertCount( 1,
48 "Only one deprecated warning per function should be kept"
53 * Broken on gallium which use an old PHPUnit version
56 function testAvoidNonConsecutivesDuplicateDeprecations() {
57 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
58 MWDebug
::warning( 'some warning' );
59 MWDebug
::log( 'we could have logged something too' );
60 // Another deprecation
61 MWDebug
::deprecated( 'wfOldFunction', '1.0', 'component' );
63 $this->assertCount( 3,
65 "Only one deprecated warning per function should be kept"