Merge "Add SPARQL client to core"
[lhc/web/wiklou.git] / tests / phpunit / includes / filerepo / RepoGroupTest.php
index f9b4ad5..5a343f6 100644 (file)
@@ -1,8 +1,12 @@
 <?php
+
+/**
+ * @covers RepoGroup
+ */
 class RepoGroupTest extends MediaWikiTestCase {
 
        function testHasForeignRepoNegative() {
-               $this->setMwGlobals( 'wgForeignFileRepos', array() );
+               $this->setMwGlobals( 'wgForeignFileRepos', [] );
                RepoGroup::destroySingleton();
                FileBackendGroup::destroySingleton();
                $this->assertFalse( RepoGroup::singleton()->hasForeignRepos() );
@@ -15,24 +19,26 @@ class RepoGroupTest extends MediaWikiTestCase {
 
        function testForEachForeignRepo() {
                $this->setUpForeignRepo();
-               $fakeCallback = $this->getMock( 'RepoGroupTestHelper' );
+               $fakeCallback = $this->createMock( RepoGroupTestHelper::class );
                $fakeCallback->expects( $this->once() )->method( 'callback' );
-               RepoGroup::singleton()->forEachForeignRepo( array( $fakeCallback, 'callback' ), array( array() ) );
+               RepoGroup::singleton()->forEachForeignRepo(
+                       [ $fakeCallback, 'callback' ], [ [] ] );
        }
 
        function testForEachForeignRepoNone() {
-               $this->setMwGlobals( 'wgForeignFileRepos', array() );
+               $this->setMwGlobals( 'wgForeignFileRepos', [] );
                RepoGroup::destroySingleton();
                FileBackendGroup::destroySingleton();
-               $fakeCallback = $this->getMock( 'RepoGroupTestHelper' );
+               $fakeCallback = $this->createMock( RepoGroupTestHelper::class );
                $fakeCallback->expects( $this->never() )->method( 'callback' );
-               RepoGroup::singleton()->forEachForeignRepo( array( $fakeCallback, 'callback' ), array( array() ) );
+               RepoGroup::singleton()->forEachForeignRepo(
+                       [ $fakeCallback, 'callback' ], [ [] ] );
        }
 
        private function setUpForeignRepo() {
                global $wgUploadDirectory;
-               $this->setMwGlobals( 'wgForeignFileRepos', array( array(
-                       'class' => 'ForeignAPIRepo',
+               $this->setMwGlobals( 'wgForeignFileRepos', [ [
+                       'class' => ForeignAPIRepo::class,
                        'name' => 'wikimediacommons',
                        'backend' => 'wikimediacommons-backend',
                        'apibase' => 'https://commons.wikimedia.org/w/api.php',
@@ -41,7 +47,7 @@ class RepoGroupTest extends MediaWikiTestCase {
                        'descriptionCacheExpiry' => 43200,
                        'apiThumbCacheExpiry' => 86400,
                        'directory' => $wgUploadDirectory
-               ) ) );
+               ] ] );
                RepoGroup::destroySingleton();
                FileBackendGroup::destroySingleton();
        }