Merge "Tweak RefreshLinksJob cache logic"
[lhc/web/wiklou.git] / tests / phpunit / tests / MediaWikiTestCaseTest.php
index 3361166..955dd2f 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 use MediaWiki\Logger\LoggerFactory;
+use Psr\Log\LoggerInterface;
 
 /**
  * @covers MediaWikiTestCase
@@ -9,12 +10,12 @@ class MediaWikiTestCaseTest extends MediaWikiTestCase {
 
        const GLOBAL_KEY_NONEXISTING = 'MediaWikiTestCaseTestGLOBAL-NONExisting';
 
-       private static $startGlobals = array(
+       private static $startGlobals = [
                'MediaWikiTestCaseTestGLOBAL-ExistingString' => 'foo',
                'MediaWikiTestCaseTestGLOBAL-ExistingStringEmpty' => '',
-               'MediaWikiTestCaseTestGLOBAL-ExistingArray' => array( 1, 'foo' => 'bar' ),
-               'MediaWikiTestCaseTestGLOBAL-ExistingArrayEmpty' => array(),
-       );
+               'MediaWikiTestCaseTestGLOBAL-ExistingArray' => [ 1, 'foo' => 'bar' ],
+               'MediaWikiTestCaseTestGLOBAL-ExistingArrayEmpty' => [],
+       ];
 
        public static function setUpBeforeClass() {
                parent::setUpBeforeClass();
@@ -31,10 +32,10 @@ class MediaWikiTestCaseTest extends MediaWikiTestCase {
        }
 
        public function provideExistingKeysAndNewValues() {
-               $providedArray = array();
+               $providedArray = [];
                foreach ( array_keys( self::$startGlobals ) as $key ) {
-                       $providedArray[] = array( $key, 'newValue' );
-                       $providedArray[] = array( $key, array( 'newValue' ) );
+                       $providedArray[] = [ $key, 'newValue' ];
+                       $providedArray[] = [ $key, [ 'newValue' ] ];
                }
                return $providedArray;
        }
@@ -105,7 +106,7 @@ class MediaWikiTestCaseTest extends MediaWikiTestCase {
        public function testLoggersAreRestoredOnTearDown() {
                // replacing an existing logger
                $logger1 = LoggerFactory::getInstance( 'foo' );
-               $this->setLogger( 'foo', $this->getMock( '\Psr\Log\LoggerInterface' ) );
+               $this->setLogger( 'foo', $this->getMock( LoggerInterface::class ) );
                $logger2 = LoggerFactory::getInstance( 'foo' );
                $this->tearDown();
                $logger3 = LoggerFactory::getInstance( 'foo' );
@@ -114,7 +115,7 @@ class MediaWikiTestCaseTest extends MediaWikiTestCase {
                $this->assertNotSame( $logger1, $logger2 );
 
                // replacing a non-existing logger
-               $this->setLogger( 'bar', $this->getMock( '\Psr\Log\LoggerInterface' ) );
+               $this->setLogger( 'foo', $this->getMock( LoggerInterface::class ) );
                $logger1 = LoggerFactory::getInstance( 'bar' );
                $this->tearDown();
                $logger2 = LoggerFactory::getInstance( 'bar' );
@@ -124,8 +125,8 @@ class MediaWikiTestCaseTest extends MediaWikiTestCase {
 
                // replacing same logger twice
                $logger1 = LoggerFactory::getInstance( 'baz' );
-               $this->setLogger( 'baz', $this->getMock( '\Psr\Log\LoggerInterface' ) );
-               $this->setLogger( 'baz', $this->getMock( '\Psr\Log\LoggerInterface' ) );
+               $this->setLogger( 'foo', $this->getMock( LoggerInterface::class ) );
+               $this->setLogger( 'foo', $this->getMock( LoggerInterface::class ) );
                $this->tearDown();
                $logger2 = LoggerFactory::getInstance( 'baz' );