appwrite/tests/unit/Network/Validators/CNAMETest.php

35 lines
920 B
PHP
Raw Normal View History

2020-02-20 22:15:53 +00:00
<?php
namespace Appwrite\Tests;
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
{
/**
* @var CNAME
*/
protected $object = null;
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
{
}
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-24 15:16:14 +00:00
$this->assertEquals($this->object->isValid('test1.appwrite.io'), true);
$this->assertEquals($this->object->isValid('test1.appwrite.io'), true);
2020-02-24 15:16:31 +00:00
$this->assertEquals($this->object->isValid('test1.appwrite.org'), false);
$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
}