1
0
Fork 0
mirror of synced 2024-06-03 11:24:48 +12:00

Fixed storage tests

This commit is contained in:
Eldad Fux 2020-07-02 19:11:07 +03:00
parent 8d24b2ee73
commit 1e74aaac37
3 changed files with 5 additions and 9 deletions

View file

@ -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')

View file

@ -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;
}

View file

@ -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
{