foreach ( $params['srcs'] as $src ) {
$source = $this->resolveToFSPath( $src );
- if ( $source === null ) {
- $fsFiles[$src] = null; // invalid path
+ if ( $source === null || !is_file( $source ) ) {
+ $fsFiles[$src] = null; // invalid path or file does not exist
} else {
$fsFiles[$src] = new FSFile( $source );
}
} else {
$tmpPath = $tmpFile->getPath();
// Copy the source file over the temp file
+ wfSuppressWarnings();
$ok = copy( $source, $tmpPath );
+ wfRestoreWarnings();
if ( !$ok ) {
$tmpFiles[$src] = null;
} else {
return $cases;
}
+ public function testGetLocalCopyAndReference404() {
+ $this->backend = $this->singleBackend;
+ $this->tearDownFiles();
+ $this->doTestGetLocalCopyAndReference404();
+ $this->tearDownFiles();
+
+ $this->backend = $this->multiBackend;
+ $this->tearDownFiles();
+ $this->doTestGetLocalCopyAndReference404();
+ $this->tearDownFiles();
+ }
+
+ public function doTestGetLocalCopyAndReference404() {
+ $backendName = $this->backendClass();
+
+ $base = self::baseStorePath();
+
+ $tmpFile = $this->backend->getLocalCopy( array(
+ 'src' => "$base/unittest-cont1/not-there" ) );
+ $this->assertEquals( null, $tmpFile, "Local copy of not existing file is null ($backendName)." );
+
+ $tmpFile = $this->backend->getLocalReference( array(
+ 'src' => "$base/unittest-cont1/not-there" ) );
+ $this->assertEquals( null, $tmpFile, "Local ref of not existing file is null ($backendName)." );
+ }
+
/**
* @dataProvider provider_testPrepareAndClean
*/