1
0
Fork 0
mirror of synced 2024-06-29 11:40:45 +12:00
appwrite/tests/unit/Network/Validators/HostTest.php
2021-03-24 14:34:47 -04:00

46 lines
1.2 KiB
PHP
Executable file

<?php
/**
* Utopia PHP Framework
*
* @package Framework
* @subpackage Tests
*
* @link https://github.com/utopia-php/framework
* @author Appwrite Team <team@appwrite.io>
* @version 1.0 RC4
* @license The MIT License (MIT) <http://www.opensource.org/licenses/mit-license.php>
*/
namespace Appwrite\Network\Validator;
use PHPUnit\Framework\TestCase;
class HostTest extends TestCase
{
/**
* @var Host
*/
protected $host = null;
public function setUp():void
{
$this->host = new Host(['appwrite.io', 'subdomain.appwrite.test', 'localhost']);
}
public function tearDown():void
{
$this->host = null;
}
public function testIsValid()
{
// Assertions
$this->assertEquals($this->host->isValid('https://appwrite.io/link'), true);
$this->assertEquals($this->host->isValid('https://localhost'), true);
$this->assertEquals($this->host->isValid('localhost'), false);
$this->assertEquals($this->host->isValid('http://subdomain.appwrite.test/path'), true);
$this->assertEquals($this->host->isValid('http://test.subdomain.appwrite.test/path'), false);
$this->assertEquals($this->host->getType(), 'string');
}
}