From f67fae9ea32b913f56b8b20262d47c658acd8d24 Mon Sep 17 00:00:00 2001 From: Armino Popp Date: Thu, 9 Jul 2020 11:45:50 +0300 Subject: [PATCH] Corrected filename from DomianTest.php to DomainTest.php --- tests/unit/Network/Validators/DomainTest.php | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/unit/Network/Validators/DomainTest.php diff --git a/tests/unit/Network/Validators/DomainTest.php b/tests/unit/Network/Validators/DomainTest.php new file mode 100644 index 000000000..b04f86d0d --- /dev/null +++ b/tests/unit/Network/Validators/DomainTest.php @@ -0,0 +1,46 @@ +domain = new Domain(); + } + + public function tearDown() + { + $this->domain = null; + } + + public function testIsValid() + { + // Assertions + $this->assertEquals(true, $this->domain->isValid('example.com')); + $this->assertEquals(true, $this->domain->isValid('subdomain.example.com')); + $this->assertEquals(true, $this->domain->isValid('subdomain.example-app.com')); + $this->assertEquals(true, $this->domain->isValid('subdomain.example_app.com')); + $this->assertEquals(true, $this->domain->isValid('subdomain-new.example.com')); + $this->assertEquals(true, $this->domain->isValid('subdomain_new.example.com')); + $this->assertEquals(true, $this->domain->isValid('localhost')); + $this->assertEquals(true, $this->domain->isValid('appwrite.io')); + $this->assertEquals(true, $this->domain->isValid('appwrite.org')); + $this->assertEquals(true, $this->domain->isValid('appwrite.org')); + $this->assertEquals(false, $this->domain->isValid(false)); + $this->assertEquals(false, $this->domain->isValid('.')); + $this->assertEquals(false, $this->domain->isValid('..')); + $this->assertEquals(false, $this->domain->isValid('')); + $this->assertEquals(false, $this->domain->isValid(['string', 'string'])); + $this->assertEquals(false, $this->domain->isValid(1)); + $this->assertEquals(false, $this->domain->isValid(1.2)); + } +} \ No newline at end of file