2020-02-21 11:15:53 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Appwrite\Tests;
|
|
|
|
|
2020-06-12 07:36:10 +12:00
|
|
|
use Appwrite\Network\Validator\CNAME;
|
2020-02-21 11:15:53 +13:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class CNAMETest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var CNAME
|
|
|
|
*/
|
|
|
|
protected $object = null;
|
|
|
|
|
2020-10-01 10:52:53 +13:00
|
|
|
public function setUp(): void
|
2020-02-21 11:15:53 +13:00
|
|
|
{
|
2020-02-25 04:16:14 +13:00
|
|
|
$this->object = new CNAME('appwrite.io');
|
2020-02-21 11:15:53 +13:00
|
|
|
}
|
|
|
|
|
2020-10-01 10:52:53 +13:00
|
|
|
public function tearDown(): void
|
2020-02-21 11:15:53 +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);
|
2020-02-25 04:16:14 +13:00
|
|
|
$this->assertEquals($this->object->isValid('test1.appwrite.io'), true);
|
|
|
|
$this->assertEquals($this->object->isValid('test1.appwrite.io'), true);
|
2020-02-25 04:16:31 +13:00
|
|
|
$this->assertEquals($this->object->isValid('test1.appwrite.org'), false);
|
|
|
|
$this->assertEquals($this->object->isValid('test1.appwrite.org'), false);
|
2020-02-21 11:15:53 +13:00
|
|
|
}
|
2020-10-01 10:52:53 +13:00
|
|
|
}
|