Skip to content

Commit

Permalink
Add test to check for absolute origin
Browse files Browse the repository at this point in the history
  • Loading branch information
ben221199 committed Feb 23, 2025
1 parent 13a7c2f commit f112646
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/Fields/FQDNTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ public function testMakeAbsolute(){
self::assertSame(['www','example','com',''],(new FQDN('www','example','com',''))->makeAbsolute($origin,true)->getValue());
}

/**
* @return void
* @throws DNSFieldException
*/
public function testMakeAbsoluteOriginRelative(){
self::expectException(DNSFieldException::class);
self::expectExceptionMessage('Origin FQDN cannot be relative.');

$origin = new FQDN('example','com');

(new FQDN('example','com'))->makeAbsolute($origin,true);
}

/**
* @return void
* @throws DNSFieldException
Expand All @@ -135,6 +148,19 @@ public function testMakeRelative(){
self::assertSame(['www'],(new FQDN('www','example','com',''))->makeRelative($origin,true)->getValue());
}

/**
* @return void
* @throws DNSFieldException
*/
public function testMakeRelativeOriginRelative(){
self::expectException(DNSFieldException::class);
self::expectExceptionMessage('Origin FQDN cannot be relative.');

$origin = new FQDN('example','com');

(new FQDN('example','com','example','com',''))->makeRelative($origin,true);
}

/**
* @return void
* @throws DNSFieldException
Expand Down

0 comments on commit f112646

Please sign in to comment.