1
0
Fork 0
mirror of synced 2024-07-03 05:31:38 +12:00
appwrite/tests/unit/Database/Validator/KeyTest.php

37 lines
1.1 KiB
PHP
Raw Normal View History

2020-06-11 09:42:16 +12:00
<?php
namespace Appwrite\Tests;
use Appwrite\Database\Validator\Key;
use PHPUnit\Framework\TestCase;
class KeyTest extends TestCase
{
/**
* @var Key
*/
protected $object = null;
2020-10-01 10:50:37 +13:00
public function setUp(): void
2020-06-11 09:42:16 +12:00
{
$this->object = new Key();
}
2020-10-01 10:50:37 +13:00
public function tearDown(): void
2020-06-11 09:42:16 +12:00
{
}
public function testValues()
{
$this->assertEquals($this->object->isValid('dasda asdasd'), false);
$this->assertEquals($this->object->isValid('asdasdasdas'), true);
$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);
}
2020-10-01 10:50:37 +13:00
}