dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Remove usages of RequestContext::getStats()"
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
debug
/
MWDebugTest.php
diff --git
a/tests/phpunit/includes/debug/MWDebugTest.php
b/tests/phpunit/includes/debug/MWDebugTest.php
index
3497c88
..
5c65483
100644
(file)
--- a/
tests/phpunit/includes/debug/MWDebugTest.php
+++ b/
tests/phpunit/includes/debug/MWDebugTest.php
@@
-4,20
+4,20
@@
class MWDebugTest extends MediaWikiTestCase {
protected function setUp() {
parent::setUp();
protected function setUp() {
parent::setUp();
- // Make sure MWDebug class is enabled
- static $MWDebugEnabled = false;
- if ( !$MWDebugEnabled ) {
- MWDebug::init();
- $MWDebugEnabled = true;
- }
/** Clear log before each test */
MWDebug::clearLog();
/** Clear log before each test */
MWDebug::clearLog();
+ }
+
+ public static function setUpBeforeClass() {
+ parent::setUpBeforeClass();
+ MWDebug::init();
MediaWiki\suppressWarnings();
}
MediaWiki\suppressWarnings();
}
- protected function tearDown() {
+ public static function tearDownAfterClass() {
+ parent::tearDownAfterClass();
+ MWDebug::deinit();
MediaWiki\restoreWarnings();
MediaWiki\restoreWarnings();
- parent::tearDown();
}
/**
}
/**
@@
-26,11
+26,11
@@
class MWDebugTest extends MediaWikiTestCase {
public function testAddLog() {
MWDebug::log( 'logging a string' );
$this->assertEquals(
public function testAddLog() {
MWDebug::log( 'logging a string' );
$this->assertEquals(
- array( array(
+ [ [
'msg' => 'logging a string',
'type' => 'log',
'caller' => 'MWDebugTest->testAddLog',
'msg' => 'logging a string',
'type' => 'log',
'caller' => 'MWDebugTest->testAddLog',
-
) )
,
+
] ]
,
MWDebug::getLog()
);
}
MWDebug::getLog()
);
}
@@
-41,11
+41,11
@@
class MWDebugTest extends MediaWikiTestCase {
public function testAddWarning() {
MWDebug::warning( 'Warning message' );
$this->assertEquals(
public function testAddWarning() {
MWDebug::warning( 'Warning message' );
$this->assertEquals(
- array( array(
+ [ [
'msg' => 'Warning message',
'type' => 'warn',
'caller' => 'MWDebugTest::testAddWarning',
'msg' => 'Warning message',
'type' => 'warn',
'caller' => 'MWDebugTest::testAddWarning',
-
) )
,
+
] ]
,
MWDebug::getLog()
);
}
MWDebug::getLog()
);
}
@@
-86,7
+86,7
@@
class MWDebugTest extends MediaWikiTestCase {
*/
public function testAppendDebugInfoToApiResultXmlFormat() {
$request = $this->newApiRequest(
*/
public function testAppendDebugInfoToApiResultXmlFormat() {
$request = $this->newApiRequest(
-
array( 'action' => 'help', 'format' => 'xml' )
,
+
[ 'action' => 'help', 'format' => 'xml' ]
,
'/api.php?action=help&format=xml'
);
'/api.php?action=help&format=xml'
);
@@
-102,9
+102,9
@@
class MWDebugTest extends MediaWikiTestCase {
$this->assertInstanceOf( 'ApiResult', $result );
$data = $result->getResultData();
$this->assertInstanceOf( 'ApiResult', $result );
$data = $result->getResultData();
- $expectedKeys =
array(
'mwVersion', 'phpEngine', 'phpVersion', 'gitRevision', 'gitBranch',
+ $expectedKeys =
[
'mwVersion', 'phpEngine', 'phpVersion', 'gitRevision', 'gitBranch',
'gitViewUrl', 'time', 'log', 'debugLog', 'queries', 'request', 'memory',
'gitViewUrl', 'time', 'log', 'debugLog', 'queries', 'request', 'memory',
- 'memoryPeak', 'includes', '_element'
)
;
+ 'memoryPeak', 'includes', '_element'
]
;
foreach ( $expectedKeys as $expectedKey ) {
$this->assertArrayHasKey( $expectedKey, $data['debuginfo'], "debuginfo has $expectedKey" );
foreach ( $expectedKeys as $expectedKey ) {
$this->assertArrayHasKey( $expectedKey, $data['debuginfo'], "debuginfo has $expectedKey" );
@@
-124,10
+124,10
@@
class MWDebugTest extends MediaWikiTestCase {
*/
private function newApiRequest( array $params, $requestUrl ) {
$request = $this->getMockBuilder( 'FauxRequest' )
*/
private function newApiRequest( array $params, $requestUrl ) {
$request = $this->getMockBuilder( 'FauxRequest' )
- ->setMethods(
array( 'getRequestURL' )
)
- ->setConstructorArgs(
array(
+ ->setMethods(
[ 'getRequestURL' ]
)
+ ->setConstructorArgs(
[
$params
$params
-
)
)
+
]
)
->getMock();
$request->expects( $this->any() )
->getMock();
$request->expects( $this->any() )