X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Ffilerepo%2FFileBackendDBRepoWrapperTest.php;h=836654103c08a64e7c7d1f679338fe02880123ae;hb=2379efaad6bddc93e7f08ca42f017890169b44e4;hp=681e3681b6b5595b4edb6a8ef83835a37491f97e;hpb=8c087b9fd13d9302ec1be2176ef1ae344b3f8273;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php b/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php index 681e3681b6..836654103c 100644 --- a/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php +++ b/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php @@ -22,7 +22,7 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { ->method( 'selectField' ) ->will( $this->returnValue( $dbReturnValue ) ); - $newPaths = $wrapperMock->getBackendPaths( array( $originalPath ), $latest ); + $newPaths = $wrapperMock->getBackendPaths( [ $originalPath ], $latest ); $this->assertEquals( $expectedBackendPath, @@ -34,8 +34,8 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { $prefix = 'mwstore://' . $this->backendName . '/' . $this->repoName; $mocksForCaching = $this->getMocks(); - return array( - array( + return [ + [ $mocksForCaching, false, $this->once(), @@ -43,8 +43,8 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { $prefix . '-public/f/o/foobar.jpg', $prefix . '-original/9/6/2/96246614d75ba1703bdfd5d7660bb57407aaf5d9', 'Public path translated correctly', - ), - array( + ], + [ $mocksForCaching, false, $this->never(), @@ -52,8 +52,8 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { $prefix . '-public/f/o/foobar.jpg', $prefix . '-original/9/6/2/96246614d75ba1703bdfd5d7660bb57407aaf5d9', 'LRU cache leveraged', - ), - array( + ], + [ $this->getMocks(), true, $this->once(), @@ -61,8 +61,8 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { $prefix . '-public/f/o/foobar.jpg', $prefix . '-original/9/6/2/96246614d75ba1703bdfd5d7660bb57407aaf5d9', 'Latest obtained', - ), - array( + ], + [ $this->getMocks(), true, $this->never(), @@ -70,8 +70,8 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { $prefix . '-deleted/f/o/foobar.jpg', $prefix . '-original/f/o/o/foobar', 'Deleted path translated correctly', - ), - array( + ], + [ $this->getMocks(), true, $this->once(), @@ -79,8 +79,8 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { $prefix . '-public/b/a/baz.jpg', $prefix . '-public/b/a/baz.jpg', 'Path left untouched if no sha1 can be found', - ), - ); + ], + ]; } /** @@ -99,13 +99,13 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { ->will( $this->returnValue( '96246614d75ba1703bdfd5d7660bb57407aaf5d9' ) ); $backendMock->expects( $this->once() ) - ->method( 'getFileContentsMulti') - ->will( $this->returnValue( array( $sha1Path => 'foo' ) ) ); + ->method( 'getFileContentsMulti' ) + ->will( $this->returnValue( [ $sha1Path => 'foo' ] ) ); - $result = $wrapperMock->getFileContentsMulti( array( 'srcs' => array( $filenamePath ) ) ); + $result = $wrapperMock->getFileContentsMulti( [ 'srcs' => [ $filenamePath ] ] ); $this->assertEquals( - array( $filenamePath => 'foo' ), + [ $filenamePath => 'foo' ], $result, 'File contents paths translated properly' ); @@ -117,22 +117,22 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase { ->getMock(); $backendMock = $this->getMock( 'FSFileBackend', - array(), - array( array( + [], + [ [ 'name' => $this->backendName, - 'wikiId' => wfWikiId() - ) ) ); + 'wikiId' => wfWikiID() + ] ] ); $wrapperMock = $this->getMock( 'FileBackendDBRepoWrapper', - array( 'getDB' ), - array( array( + [ 'getDB' ], + [ [ 'backend' => $backendMock, 'repoName' => $this->repoName, 'dbHandleFactory' => null - ) ) ); + ] ] ); $wrapperMock->expects( $this->any() )->method( 'getDB' )->will( $this->returnValue( $dbMock ) ); - return array( $dbMock, $backendMock, $wrapperMock ); + return [ $dbMock, $backendMock, $wrapperMock ]; } }