mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
fix tests
This commit is contained in:
parent
fa68acc4be
commit
d9167a9d06
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\System\File;
|
||||
|
||||
use phpOMS\Autoloader;
|
||||
|
||||
/**
|
||||
* Filesystem class.
|
||||
*
|
||||
|
|
@ -71,15 +73,18 @@ final class Storage
|
|||
throw new \Exception('Invalid type');
|
||||
}
|
||||
} else {
|
||||
$stg = $env;
|
||||
$env = \ucfirst(\strtolower($env));
|
||||
/** @var StorageAbstract $env */
|
||||
$env = __NAMESPACE__ . '\\' . $env . '\\' . $env . 'Storage';
|
||||
$stg = \ucfirst(\strtolower($env));
|
||||
$stg = __NAMESPACE__ . '\\' . $stg . '\\' . $stg . 'Storage';
|
||||
|
||||
if (!Autoloader::exists($stg)) {
|
||||
throw new \Exception('Invalid type');
|
||||
}
|
||||
|
||||
/** @var StorageAbstract $stg */
|
||||
/** @var StorageAbstract $instance */
|
||||
$instance = new $env();
|
||||
$instance = new $stg();
|
||||
|
||||
self::$registered[$stg] = $instance;
|
||||
self::$registered[$env] = $instance;
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ final class StorageTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testInvalidStorage() : void
|
||||
{
|
||||
$this->expectException(\Error::class);
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
self::assertInstanceOf('\phpOMS\System\File\Local\LocalStorage', Storage::env('invalid'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user