mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-09 21:48:41 +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;
|
namespace phpOMS\System\File;
|
||||||
|
|
||||||
|
use phpOMS\Autoloader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filesystem class.
|
* Filesystem class.
|
||||||
*
|
*
|
||||||
|
|
@ -71,15 +73,18 @@ final class Storage
|
||||||
throw new \Exception('Invalid type');
|
throw new \Exception('Invalid type');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$stg = $env;
|
$stg = \ucfirst(\strtolower($env));
|
||||||
$env = \ucfirst(\strtolower($env));
|
$stg = __NAMESPACE__ . '\\' . $stg . '\\' . $stg . 'Storage';
|
||||||
/** @var StorageAbstract $env */
|
|
||||||
$env = __NAMESPACE__ . '\\' . $env . '\\' . $env . 'Storage';
|
|
||||||
|
|
||||||
|
if (!Autoloader::exists($stg)) {
|
||||||
|
throw new \Exception('Invalid type');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var StorageAbstract $stg */
|
||||||
/** @var StorageAbstract $instance */
|
/** @var StorageAbstract $instance */
|
||||||
$instance = new $env();
|
$instance = new $stg();
|
||||||
|
|
||||||
self::$registered[$stg] = $instance;
|
self::$registered[$env] = $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $instance;
|
return $instance;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ final class StorageTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testInvalidStorage() : void
|
public function testInvalidStorage() : void
|
||||||
{
|
{
|
||||||
$this->expectException(\Error::class);
|
$this->expectException(\Exception::class);
|
||||||
|
|
||||||
self::assertInstanceOf('\phpOMS\System\File\Local\LocalStorage', Storage::env('invalid'));
|
self::assertInstanceOf('\phpOMS\System\File\Local\LocalStorage', Storage::env('invalid'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user