2019-12-27 18:50:44 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Appwrite\Tests;
|
|
|
|
|
|
|
|
use Exception;
|
|
|
|
use Storage\Devices\Local;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class LocalTest extends TestCase
|
|
|
|
{
|
2019-12-28 04:13:38 +13:00
|
|
|
/**
|
|
|
|
* @var Local
|
|
|
|
*/
|
|
|
|
protected $object = null;
|
|
|
|
|
2019-12-27 18:50:44 +13:00
|
|
|
public function setUp()
|
|
|
|
{
|
2019-12-28 04:13:38 +13:00
|
|
|
$this->object = new Local(__DIR__ . '/../../../resources/disk-a');
|
2019-12-27 18:50:44 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
public function tearDown()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-12-28 04:13:38 +13:00
|
|
|
public function testName()
|
|
|
|
{
|
|
|
|
$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()
|
2019-12-27 18:50:44 +13:00
|
|
|
{
|
2019-12-28 04:13:38 +13:00
|
|
|
$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');
|
2019-12-27 18:50:44 +13:00
|
|
|
}
|
|
|
|
}
|