Changed quoting function for oracleDB.
[mediawiki.git] / tests / phpunit / includes / debug / MWDebugTest.php
blob9026cb90d646c4d512b2537a5cb0267824d406f7
1 <?php
3 class MWDebugTest extends MediaWikiTestCase {
6 protected function setUp() {
7 parent::setUp();
8 // Make sure MWDebug class is enabled
9 static $MWDebugEnabled = false;
10 if ( !$MWDebugEnabled ) {
11 MWDebug::init();
12 $MWDebugEnabled = true;
14 /** Clear log before each test */
15 MWDebug::clearLog();
16 wfSuppressWarnings();
19 protected function tearDown() {
20 wfRestoreWarnings();
21 parent::tearDown();
24 function testAddLog() {
25 MWDebug::log( 'logging a string' );
26 $this->assertEquals(
27 array( array(
28 'msg' => 'logging a string',
29 'type' => 'log',
30 'caller' => __METHOD__,
31 ) ),
32 MWDebug::getLog()
36 function testAddWarning() {
37 MWDebug::warning( 'Warning message' );
38 $this->assertEquals(
39 array( array(
40 'msg' => 'Warning message',
41 'type' => 'warn',
42 'caller' => 'MWDebugTest::testAddWarning',
43 ) ),
44 MWDebug::getLog()
48 function testAvoidDuplicateDeprecations() {
49 MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
50 MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
52 // assertCount() not available on WMF integration server
53 $this->assertEquals( 1,
54 count( MWDebug::getLog() ),
55 "Only one deprecated warning per function should be kept"
59 function testAvoidNonConsecutivesDuplicateDeprecations() {
60 MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
61 MWDebug::warning( 'some warning' );
62 MWDebug::log( 'we could have logged something too' );
63 // Another deprecation
64 MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
66 // assertCount() not available on WMF integration server
67 $this->assertEquals( 3,
68 count( MWDebug::getLog() ),
69 "Only one deprecated warning per function should be kept"