MediaWiki  1.23.13
MWDebugTest.php
Go to the documentation of this file.
1 <?php
2 
4 
5  protected function setUp() {
6  parent::setUp();
7  // Make sure MWDebug class is enabled
8  static $MWDebugEnabled = false;
9  if ( !$MWDebugEnabled ) {
10  MWDebug::init();
11  $MWDebugEnabled = true;
12  }
16  }
17 
18  protected function tearDown() {
20  parent::tearDown();
21  }
22 
26  public function testAddLog() {
27  MWDebug::log( 'logging a string' );
28  $this->assertEquals(
29  array( array(
30  'msg' => 'logging a string',
31  'type' => 'log',
32  'caller' => __METHOD__,
33  ) ),
35  );
36  }
37 
41  public function testAddWarning() {
42  MWDebug::warning( 'Warning message' );
43  $this->assertEquals(
44  array( array(
45  'msg' => 'Warning message',
46  'type' => 'warn',
47  'caller' => 'MWDebugTest::testAddWarning',
48  ) ),
50  );
51  }
52 
56  public function testAvoidDuplicateDeprecations() {
57  MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
58  MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
59 
60  // assertCount() not available on WMF integration server
61  $this->assertEquals( 1,
62  count( MWDebug::getLog() ),
63  "Only one deprecated warning per function should be kept"
64  );
65  }
66 
71  MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
72  MWDebug::warning( 'some warning' );
73  MWDebug::log( 'we could have logged something too' );
74  // Another deprecation
75  MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
76 
77  // assertCount() not available on WMF integration server
78  $this->assertEquals( 3,
79  count( MWDebug::getLog() ),
80  "Only one deprecated warning per function should be kept"
81  );
82  }
83 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2434
MWDebugTest\testAddLog
testAddLog()
@covers MWDebug::log
Definition: MWDebugTest.php:26
MWDebug\getLog
static getLog()
Returns internal log array.
Definition: Debug.php:118
MWDebugTest\testAddWarning
testAddWarning()
@covers MWDebug::warning
Definition: MWDebugTest.php:41
MWDebugTest\tearDown
tearDown()
Definition: MWDebugTest.php:18
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
MWDebug\clearLog
static clearLog()
Clears internal log array and deprecation tracking.
Definition: Debug.php:126
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
MWDebug\deprecated
static deprecated( $function, $version=false, $component=false, $callerOffset=2)
Show a warning that $function is deprecated.
Definition: Debug.php:187
MWDebug\log
static log( $str)
Adds a line to the log.
Definition: Debug.php:101
MWDebugTest\testAvoidDuplicateDeprecations
testAvoidDuplicateDeprecations()
@covers MWDebug::deprecated
Definition: MWDebugTest.php:56
MWDebugTest
Definition: MWDebugTest.php:3
MWDebug\init
static init()
Enabled the debugger and load resource module.
Definition: Debug.php:76
MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations
testAvoidNonConsecutivesDuplicateDeprecations()
@covers MWDebug::deprecated
Definition: MWDebugTest.php:70
MWDebugTest\setUp
setUp()
Definition: MWDebugTest.php:5
MWDebug\warning
static warning( $msg, $callerOffset=1, $level=E_USER_NOTICE, $log='auto')
Adds a warning entry to the log.
Definition: Debug.php:144