Added unit tests for storage devices
This commit is contained in:
parent
33a07bd858
commit
c16267bc0c
|
@ -34,7 +34,7 @@ class Local extends Device
|
|||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return 'Just the local storage that is in the physical or virtual machine';
|
||||
return 'Adapter for Local storage that is in the physical or virtual machine or mounted to it.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace Appwrite\Tests;
|
|||
|
||||
use Exception;
|
||||
use Storage\Compression\Algorithms\GZIP;
|
||||
use Storage\Devices\Local;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class GZIPTest extends TestCase
|
||||
|
|
|
@ -3,24 +3,44 @@
|
|||
namespace Appwrite\Tests;
|
||||
|
||||
use Exception;
|
||||
use Storage\Storage;
|
||||
use Storage\Devices\Local;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LocalTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Local
|
||||
*/
|
||||
protected $object = null;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->object = new Local(__DIR__ . '/../../../resources/disk-a');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
public function testName()
|
||||
{
|
||||
$this->assertEquals(Storage::exists('disk-a'), true);
|
||||
$this->assertEquals(Storage::exists('disk-b'), true);
|
||||
$this->assertEquals(Storage::exists('disk-c'), false);
|
||||
$this->assertEquals($this->object->getName(), 'Local Storage');
|
||||
}
|
||||
|
||||
public function testDescription()
|
||||
{
|
||||
$this->assertEquals($this->object->getDescription(), 'Adapter for Local storage that is in the physical or virtual machine or mounted to it.');
|
||||
}
|
||||
|
||||
public function testRoot()
|
||||
{
|
||||
$this->assertEquals($this->object->getRoot(), '/storage/uploads//usr/share/nginx/html/tests/unit/Storage/Devices/../../../resources/disk-a');
|
||||
}
|
||||
|
||||
public function testPath()
|
||||
{
|
||||
$this->assertEquals($this->object->getPath('image.png'), '/storage/uploads//usr/share/nginx/html/tests/unit/Storage/Devices/../../../resources/disk-a/i/m/a/g/image.png');
|
||||
$this->assertEquals($this->object->getPath('x.png'), '/storage/uploads//usr/share/nginx/html/tests/unit/Storage/Devices/../../../resources/disk-a/x/./p/n/x.png');
|
||||
$this->assertEquals($this->object->getPath('y'), '/storage/uploads//usr/share/nginx/html/tests/unit/Storage/Devices/../../../resources/disk-a/y/x/x/x/y');
|
||||
}
|
||||
}
|
|
@ -7,8 +7,8 @@ use Storage\Storage;
|
|||
use Storage\Devices\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::addDevice('disk-a', new Local(__DIR__ . '/../../resources/disk-a'));
|
||||
Storage::addDevice('disk-b', new Local(__DIR__ . '/../../resources/disk-b'));
|
||||
|
||||
class StorageTest extends TestCase
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue