1
0
Fork 0
mirror of synced 2024-07-03 05:31:38 +12:00
appwrite/tests/unit/Storage/StorageTest.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2019-12-27 06:25:59 +13:00
<?php
namespace Appwrite\Tests;
use Exception;
use Appwrite\Storage\Storage;
2020-06-12 07:36:10 +12:00
use Appwrite\Storage\Device\Local;
2019-12-27 06:25:59 +13:00
use PHPUnit\Framework\TestCase;
2019-12-28 04:13:38 +13:00
Storage::addDevice('disk-a', new Local(__DIR__ . '/../../resources/disk-a'));
Storage::addDevice('disk-b', new Local(__DIR__ . '/../../resources/disk-b'));
2019-12-27 06:25:59 +13:00
class StorageTest extends TestCase
{
public function setUp()
{
}
public function tearDown()
{
}
public function testGetters()
{
2020-06-12 07:36:10 +12:00
$this->assertEquals(get_class(Storage::getDevice('disk-a')), 'Appwrite\Storage\Device\Local');
$this->assertEquals(get_class(Storage::getDevice('disk-b')), 'Appwrite\Storage\Device\Local');
2019-12-27 06:25:59 +13:00
try {
get_class(Storage::getDevice('disk-c'));
$this->fail("Expected exception not thrown");
} catch(Exception $e) {
$this->assertEquals('The device "disk-c" is not listed', $e->getMessage());
}
}
public function testExists()
{
$this->assertEquals(Storage::exists('disk-a'), true);
$this->assertEquals(Storage::exists('disk-b'), true);
$this->assertEquals(Storage::exists('disk-c'), false);
}
}