fix file_exists replacement

This commit is contained in:
Dennis Eichhorn 2020-10-08 17:52:52 +02:00
parent b6e6aabacd
commit 2755594d3c
2 changed files with 6 additions and 2 deletions

View File

@ -52,9 +52,13 @@ final class Installer extends InstallerAbstract
return; // @codeCoverageIgnore
}
if (!\is_file($data['path'] ?? '')) {
throw new PathException($data['path'] ?? '');
}
$mediaFile = \file_get_contents($data['path'] ?? '');
if ($mediaFile === false) {
throw new PathException($data['path'] ?? '');
throw new PathException($data['path'] ?? ''); // @codeCoverageIgnore
}
$mediaData = \json_decode($mediaFile, true);

View File

@ -36,7 +36,7 @@ class AdminTest extends \PHPUnit\Framework\TestCase
public function testInvalidMediaInstallJsonFile() : void
{
$this->expectException(\PathException::class);
$this->expectException(\Exception::class);
Installer::installExternal($GLOBALS['dbpool'], ['path' => 'invalidJson.json']);
}