Fixed storage tests
This commit is contained in:
parent
8d24b2ee73
commit
1e74aaac37
|
@ -24,7 +24,7 @@ use Appwrite\OpenSSL\OpenSSL;
|
|||
use Utopia\Config\Config;
|
||||
|
||||
App::init(function ($project) {
|
||||
Storage::addDevice('local', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId()));
|
||||
Storage::setDevice('local', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId()));
|
||||
}, ['project'], 'storage');
|
||||
|
||||
App::post('/v1/storage/files')
|
||||
|
|
|
@ -16,7 +16,7 @@ class Storage
|
|||
public static $devices = array();
|
||||
|
||||
/**
|
||||
* Add Device.
|
||||
* Set Device.
|
||||
*
|
||||
* Add device by name
|
||||
*
|
||||
|
@ -25,12 +25,8 @@ class Storage
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function addDevice($name, Device $device)
|
||||
public static function setDevice($name, Device $device)
|
||||
{
|
||||
if (\array_key_exists($name, self::$devices)) {
|
||||
throw new Exception('The device "'.$name.'" is already listed');
|
||||
}
|
||||
|
||||
self::$devices[$name] = $device;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ use Appwrite\Storage\Storage;
|
|||
use Appwrite\Storage\Device\Local;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
Storage::addDevice('disk-a', new Local(__DIR__ . '/../../resources/disk-a'));
|
||||
Storage::addDevice('disk-b', new Local(__DIR__ . '/../../resources/disk-b'));
|
||||
Storage::setDevice('disk-a', new Local(__DIR__ . '/../../resources/disk-a'));
|
||||
Storage::setDevice('disk-b', new Local(__DIR__ . '/../../resources/disk-b'));
|
||||
|
||||
class StorageTest extends TestCase
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue