Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Unit/DomainTest.php
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | class DomainTest extends TestCase | ||||
*/ | */ | ||||
public function testHash(): void | public function testHash(): void | ||||
{ | { | ||||
$domain = new Domain([ | $domain = new Domain([ | ||||
'namespace' => 'test.com', | 'namespace' => 'test.com', | ||||
'status' => Domain::STATUS_NEW, | 'status' => Domain::STATUS_NEW, | ||||
]); | ]); | ||||
$hash1 = $domain->hash(true); | $hash_code = $domain->hash(); | ||||
$this->assertRegExp('/^[a-f0-9]{32}$/', $hash1); | $this->assertRegExp('/^[a-f0-9]{32}$/', $hash_code); | ||||
$hash2 = $domain->hash(); | $hash_text = $domain->hash(Domain::HASH_TEXT); | ||||
$this->assertRegExp('/^kolab-verify=[a-f0-9]{32}$/', $hash2); | $this->assertRegExp('/^kolab-verify=[a-f0-9]{32}$/', $hash_text); | ||||
$this->assertSame($hash1, str_replace('kolab-verify=', '', $hash2)); | $this->assertSame($hash_code, str_replace('kolab-verify=', '', $hash_text)); | ||||
$hash_cname = $domain->hash(Domain::HASH_CNAME); | |||||
$this->assertSame('kolab-verify', $hash_cname); | |||||
$hash_code2 = $domain->hash(Domain::HASH_CODE); | |||||
$this->assertSame($hash_code, $hash_code2); | |||||
} | } | ||||
} | } |