aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/filerepo/file/FileTest.php
diff options
context:
space:
mode:
authorUmherirrender <umherirrender_de.wp@web.de>2020-10-30 20:48:01 +0100
committerUmherirrender <umherirrender_de.wp@web.de>2020-12-12 14:56:12 +0000
commit8f80236a6f81b711b5853c8fee9ce801bb756188 (patch)
tree3f4e19cf446e1c88c41fa7400120bd0775ab1ba7 /tests/phpunit/includes/filerepo/file/FileTest.php
parentf46ca9a63c6396eaa237a219a1f3c5fe93d55b22 (diff)
downloadmediawikicore-8f80236a6f81b711b5853c8fee9ce801bb756188.tar.gz
mediawikicore-8f80236a6f81b711b5853c8fee9ce801bb756188.zip
[FileTest] Do not assume /tmp exists on windows
Needs to be a real path, not relative one 6) FileTest::testGetThumbnailSource with data set #2 (array(true, array('/tmp'), 1024, 2048, '/tmp', 'Temporary path because temp f... found')) Temporary path because temp file was found Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'/tmp' +'fsFilePath' The file_exists in File::getThumbnailSource gets the path '/tmp' and that does not exists on windows, because it is relative to one of the core folder Change-Id: I8618c8b34261451da42f88360a9d65353960e91f
Diffstat (limited to 'tests/phpunit/includes/filerepo/file/FileTest.php')
-rw-r--r--tests/phpunit/includes/filerepo/file/FileTest.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/phpunit/includes/filerepo/file/FileTest.php b/tests/phpunit/includes/filerepo/file/FileTest.php
index 6ca4a32b28d9..76be387442ff 100644
--- a/tests/phpunit/includes/filerepo/file/FileTest.php
+++ b/tests/phpunit/includes/filerepo/file/FileTest.php
@@ -146,6 +146,7 @@ class FileTest extends MediaWikiMediaTestCase {
->setMethods( [ 'fileExists', 'getLocalReference' ] )
->getMock();
+ $tempDir = wfTempDir();
$fsFile = new FSFile( 'fsFilePath' );
$repoMock->expects( $this->any() )
@@ -185,6 +186,9 @@ class FileTest extends MediaWikiMediaTestCase {
$reflection_property->setValue( $fileMock, $handlerMock );
if ( $data['tmpBucketedThumbCache'] !== null ) {
+ foreach ( $data['tmpBucketedThumbCache'] as $bucket => &$tmpBucketed ) {
+ $tmpBucketed = str_replace( '/tmp', $tempDir, $tmpBucketed );
+ }
$reflection_property = $reflection->getProperty( 'tmpBucketedThumbCache' );
$reflection_property->setAccessible( true );
$reflection_property->setValue( $fileMock, $data['tmpBucketedThumbCache'] );
@@ -193,7 +197,11 @@ class FileTest extends MediaWikiMediaTestCase {
$result = $fileMock->getThumbnailSource(
[ 'physicalWidth' => $data['physicalWidth'] ] );
- $this->assertEquals( $data['expectedPath'], $result['path'], $data['message'] );
+ $this->assertEquals(
+ str_replace( '/tmp', $tempDir, $data['expectedPath'] ),
+ $result['path'],
+ $data['message']
+ );
}
public function getThumbnailSourceProvider() {