2020-02-21 11:15:53 +13:00
|
|
|
<?php
|
|
|
|
|
2022-08-01 22:22:04 +12:00
|
|
|
namespace Tests\Unit\Network\Validators;
|
2020-02-21 11:15:53 +13:00
|
|
|
|
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
|
|
|
|
{
|
2022-08-01 22:22:04 +12:00
|
|
|
protected ?CNAME $object = null;
|
2020-02-21 11:15:53 +13:00
|
|
|
|
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
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-08-01 22:22:04 +12:00
|
|
|
public function testValues(): void
|
2020-02-21 11:15:53 +13:00
|
|
|
{
|
|
|
|
$this->assertEquals($this->object->isValid(''), false);
|
|
|
|
$this->assertEquals($this->object->isValid(null), false);
|
|
|
|
$this->assertEquals($this->object->isValid(false), false);
|
2022-05-31 02:45:13 +12:00
|
|
|
$this->assertEquals($this->object->isValid('cname-unit-test.appwrite.org'), true);
|
2020-02-25 04:16:31 +13:00
|
|
|
$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
|
|
|
}
|