From 32d8d7d68c947fa6c035a879b429d605b9834796 Mon Sep 17 00:00:00 2001 From: Suven-p Date: Wed, 19 Jul 2023 22:00:05 +0545 Subject: [PATCH] Add requested additional tests --- tests/DomainTest.php | 80 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/tests/DomainTest.php b/tests/DomainTest.php index c773985..28e3f59 100755 --- a/tests/DomainTest.php +++ b/tests/DomainTest.php @@ -275,4 +275,84 @@ public function testSubSubWwwCk(): void $this->assertEquals(false, $domain->isPrivate()); $this->assertEquals(false, $domain->isTest()); } + + public function testWildcardNomBr(): void + { + $domain = new Domain('sub.example.com.nom.br'); + + $this->assertEquals('sub.example.com.nom.br', $domain->get()); + $this->assertEquals('br', $domain->getTLD()); + $this->assertEquals('com.nom.br', $domain->getSuffix()); + $this->assertEquals('example.com.nom.br', $domain->getRegisterable()); + $this->assertEquals('example', $domain->getName()); + $this->assertEquals('sub', $domain->getSub()); + $this->assertEquals(true, $domain->isKnown()); + $this->assertEquals(true, $domain->isICANN()); + $this->assertEquals(false, $domain->isPrivate()); + $this->assertEquals(false, $domain->isTest()); + } + + public function testWildcardKawasakiJp(): void + { + $domain = new Domain('sub.example.com.kawasaki.jp'); + + $this->assertEquals('sub.example.com.kawasaki.jp', $domain->get()); + $this->assertEquals('jp', $domain->getTLD()); + $this->assertEquals('com.kawasaki.jp', $domain->getSuffix()); + $this->assertEquals('example.com.kawasaki.jp', $domain->getRegisterable()); + $this->assertEquals('example', $domain->getName()); + $this->assertEquals('sub', $domain->getSub()); + $this->assertEquals(true, $domain->isKnown()); + $this->assertEquals(true, $domain->isICANN()); + $this->assertEquals(false, $domain->isPrivate()); + $this->assertEquals(false, $domain->isTest()); + } + + public function testExceptionKawasakiJp(): void + { + $domain = new Domain('sub.city.kawasaki.jp'); + + $this->assertEquals('sub.city.kawasaki.jp', $domain->get()); + $this->assertEquals('jp', $domain->getTLD()); + $this->assertEquals('kawasaki.jp', $domain->getSuffix()); + $this->assertEquals('city.kawasaki.jp', $domain->getRegisterable()); + $this->assertEquals('city', $domain->getName()); + $this->assertEquals('sub', $domain->getSub()); + $this->assertEquals(true, $domain->isKnown()); + $this->assertEquals(true, $domain->isICANN()); + $this->assertEquals(false, $domain->isPrivate()); + $this->assertEquals(false, $domain->isTest()); + } + + public function testWildcardPrivateDomain(): void + { + $domain = new Domain('sub.example.com.dev.adobeaemcloud.com'); + + $this->assertEquals('sub.example.com.dev.adobeaemcloud.com', $domain->get()); + $this->assertEquals('com', $domain->getTLD()); + $this->assertEquals('com.dev.adobeaemcloud.com', $domain->getSuffix()); + $this->assertEquals('example.com.dev.adobeaemcloud.com', $domain->getRegisterable()); + $this->assertEquals('example', $domain->getName()); + $this->assertEquals('sub', $domain->getSub()); + $this->assertEquals(true, $domain->isKnown()); + $this->assertEquals(false, $domain->isICANN()); + $this->assertEquals(true, $domain->isPrivate()); + $this->assertEquals(false, $domain->isTest()); + } + + public function testPrivateDomain(): void + { + $domain = new Domain('sub.example.adobeaemcloud.net'); + + $this->assertEquals('sub.example.adobeaemcloud.net', $domain->get()); + $this->assertEquals('net', $domain->getTLD()); + $this->assertEquals('adobeaemcloud.net', $domain->getSuffix()); + $this->assertEquals('example.adobeaemcloud.net', $domain->getRegisterable()); + $this->assertEquals('example', $domain->getName()); + $this->assertEquals('sub', $domain->getSub()); + $this->assertEquals(true, $domain->isKnown()); + $this->assertEquals(false, $domain->isICANN()); + $this->assertEquals(true, $domain->isPrivate()); + $this->assertEquals(false, $domain->isTest()); + } }