2019-12-27 08:44:12 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Appwrite\Tests;
|
|
|
|
|
2020-03-25 06:56:32 +13:00
|
|
|
use Appwrite\Storage\Validators\FileType;
|
2019-12-27 08:44:12 +13:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class FileTypeTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var FileType
|
|
|
|
*/
|
|
|
|
protected $object = null;
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->object = new FileType([FileType::FILE_TYPE_JPEG]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tearDown()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testValues()
|
|
|
|
{
|
|
|
|
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-1.jpg'), true);
|
|
|
|
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), true);
|
2019-12-27 08:58:37 +13:00
|
|
|
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-b/kitten-1.png'), false);
|
|
|
|
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-b/kitten-2.png'), false);
|
2019-12-27 08:44:12 +13:00
|
|
|
}
|
|
|
|
}
|