2019-12-27 06:25:59 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Appwrite\Tests;
|
|
|
|
|
2020-06-12 07:36:10 +12:00
|
|
|
use Appwrite\Storage\Validator\FileName;
|
2019-12-27 06:25:59 +13:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class FileNameTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var FileName
|
|
|
|
*/
|
|
|
|
protected $object = null;
|
|
|
|
|
2020-10-01 10:55:06 +13:00
|
|
|
public function setUp(): void
|
2019-12-27 06:25:59 +13:00
|
|
|
{
|
|
|
|
$this->object = new FileName();
|
|
|
|
}
|
|
|
|
|
2020-10-01 10:55:06 +13:00
|
|
|
public function tearDown(): void
|
2019-12-27 06:25:59 +13:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testValues()
|
|
|
|
{
|
|
|
|
$this->assertEquals($this->object->isValid(''), false);
|
|
|
|
$this->assertEquals($this->object->isValid(null), false);
|
|
|
|
$this->assertEquals($this->object->isValid(false), false);
|
|
|
|
$this->assertEquals($this->object->isValid('../test'), false);
|
|
|
|
$this->assertEquals($this->object->isValid('test.png'), true);
|
|
|
|
$this->assertEquals($this->object->isValid('test'), true);
|
|
|
|
}
|
2020-10-01 10:55:06 +13:00
|
|
|
}
|