mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
test for custom id
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Tests;
|
||||
|
||||
use Appwrite\Database\Validator\CustomId;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CustomIdTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Key
|
||||
*/
|
||||
protected $object = null;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->object = new CustomId();
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
public function testValues()
|
||||
{
|
||||
$this->assertEquals($this->object->isValid('unique()'), true);
|
||||
$this->assertEquals($this->object->isValid('unique)'), false);
|
||||
$this->assertEquals($this->object->isValid('else()'), false);
|
||||
$this->assertEquals($this->object->isValid('dasda asdasd'), false);
|
||||
$this->assertEquals($this->object->isValid('dasda_asdasd'), true);
|
||||
$this->assertEquals($this->object->isValid('asdasdasdas'), true);
|
||||
$this->assertEquals($this->object->isValid('_asdasdasdas'), false);
|
||||
$this->assertEquals($this->object->isValid('as$$5dasdasdas'), false);
|
||||
$this->assertEquals($this->object->isValid(false), false);
|
||||
$this->assertEquals($this->object->isValid(null), false);
|
||||
$this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscribers'), false);
|
||||
$this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscriber'), false);
|
||||
$this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscribe'), true);
|
||||
$this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscrib'), true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user