mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-17 01:38:41 +00:00
fix file_exists replacement
This commit is contained in:
parent
b6e6aabacd
commit
2755594d3c
|
|
@ -52,9 +52,13 @@ final class Installer extends InstallerAbstract
|
||||||
return; // @codeCoverageIgnore
|
return; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!\is_file($data['path'] ?? '')) {
|
||||||
|
throw new PathException($data['path'] ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
$mediaFile = \file_get_contents($data['path'] ?? '');
|
$mediaFile = \file_get_contents($data['path'] ?? '');
|
||||||
if ($mediaFile === false) {
|
if ($mediaFile === false) {
|
||||||
throw new PathException($data['path'] ?? '');
|
throw new PathException($data['path'] ?? ''); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$mediaData = \json_decode($mediaFile, true);
|
$mediaData = \json_decode($mediaFile, true);
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class AdminTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
public function testInvalidMediaInstallJsonFile() : void
|
public function testInvalidMediaInstallJsonFile() : void
|
||||||
{
|
{
|
||||||
$this->expectException(\PathException::class);
|
$this->expectException(\Exception::class);
|
||||||
|
|
||||||
Installer::installExternal($GLOBALS['dbpool'], ['path' => 'invalidJson.json']);
|
Installer::installExternal($GLOBALS['dbpool'], ['path' => 'invalidJson.json']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user