2020-02-20 22:15:53 +00:00
|
|
|
<?php
|
|
|
|
|
|
2022-08-01 10:22:04 +00:00
|
|
|
namespace Tests\Unit\Network\Validators;
|
2020-02-20 22:15:53 +00:00
|
|
|
|
2020-06-11 19:36:10 +00:00
|
|
|
use Appwrite\Network\Validator\CNAME;
|
2020-02-20 22:15:53 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
|
|
class CNAMETest extends TestCase
|
|
|
|
|
{
|
2022-08-01 10:22:04 +00:00
|
|
|
protected ?CNAME $object = null;
|
2020-02-20 22:15:53 +00:00
|
|
|
|
2020-09-30 21:52:53 +00:00
|
|
|
public function setUp(): void
|
2020-02-20 22:15:53 +00:00
|
|
|
{
|
2020-02-24 15:16:14 +00:00
|
|
|
$this->object = new CNAME('appwrite.io');
|
2020-02-20 22:15:53 +00:00
|
|
|
}
|
|
|
|
|
|
2020-09-30 21:52:53 +00:00
|
|
|
public function tearDown(): void
|
2020-02-20 22:15:53 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-01 10:22:04 +00:00
|
|
|
public function testValues(): void
|
2020-02-20 22:15:53 +00:00
|
|
|
{
|
|
|
|
|
$this->assertEquals($this->object->isValid(''), false);
|
|
|
|
|
$this->assertEquals($this->object->isValid(null), false);
|
|
|
|
|
$this->assertEquals($this->object->isValid(false), false);
|
2022-05-30 14:45:13 +00:00
|
|
|
$this->assertEquals($this->object->isValid('cname-unit-test.appwrite.org'), true);
|
2020-02-24 15:16:31 +00:00
|
|
|
$this->assertEquals($this->object->isValid('test1.appwrite.org'), false);
|
2020-02-20 22:15:53 +00:00
|
|
|
}
|
2020-09-30 21:52:53 +00:00
|
|
|
}
|