Skip to content

Commit

Permalink
Add tests for wildcard and exception rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Suven-p committed Apr 19, 2023
1 parent 741bd5e commit 4723ec0
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions tests/DomainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,68 @@ public function testHTTPSException2(): void

new Domain('https://facbook.com');
}

public function testExampleExampleCk(): void
{
$domain = new Domain('example.example.ck');

$this->assertEquals('example.example.ck', $domain->get());
$this->assertEquals('ck', $domain->getTLD());
$this->assertEquals('example.ck', $domain->getSuffix());
$this->assertEquals('example.example.ck', $domain->getRegisterable());
$this->assertEquals('example', $domain->getName());
$this->assertEquals('', $domain->getSub());
$this->assertEquals(true, $domain->isKnown());
$this->assertEquals(true, $domain->isICANN());
$this->assertEquals(false, $domain->isPrivate());
$this->assertEquals(false, $domain->isTest());
}

public function testSubSubExampleExampleCk(): void
{
$domain = new Domain('subsub.demo.example.example.ck');

$this->assertEquals('subsub.demo.example.example.ck', $domain->get());
$this->assertEquals('ck', $domain->getTLD());
$this->assertEquals('example.ck', $domain->getSuffix());
$this->assertEquals('example.example.ck', $domain->getRegisterable());
$this->assertEquals('example', $domain->getName());
$this->assertEquals('subsub.demo', $domain->getSub());
$this->assertEquals(true, $domain->isKnown());
$this->assertEquals(true, $domain->isICANN());
$this->assertEquals(false, $domain->isPrivate());
$this->assertEquals(false, $domain->isTest());
}

public function testWwwCk(): void
{
$domain = new Domain('www.ck');

$this->assertEquals('www.ck', $domain->get());
$this->assertEquals('ck', $domain->getTLD());
$this->assertEquals('ck', $domain->getSuffix());
$this->assertEquals('www.ck', $domain->getRegisterable());
$this->assertEquals('www', $domain->getName());
$this->assertEquals('', $domain->getSub());
$this->assertEquals(true, $domain->isKnown());
$this->assertEquals(true, $domain->isICANN());
$this->assertEquals(false, $domain->isPrivate());
$this->assertEquals(false, $domain->isTest());
}

public function testSubSubWwwCk(): void
{
$domain = new Domain('subsub.demo.www.ck');

$this->assertEquals('subsub.demo.www.ck', $domain->get());
$this->assertEquals('ck', $domain->getTLD());
$this->assertEquals('ck', $domain->getSuffix());
$this->assertEquals('www.ck', $domain->getRegisterable());
$this->assertEquals('www', $domain->getName());
$this->assertEquals('subsub.demo', $domain->getSub());
$this->assertEquals(true, $domain->isKnown());
$this->assertEquals(true, $domain->isICANN());
$this->assertEquals(false, $domain->isPrivate());
$this->assertEquals(false, $domain->isTest());
}
}

0 comments on commit 4723ec0

Please sign in to comment.