Skip to content

Commit 1b634d4

Browse files
committed
test: private domain with subdomain wildcard
When a private domain is listed, with an additional wildcard on a subdomain, the private domain itself is not resolved. Confirms #363
1 parent 0a3902e commit 1b634d4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/RulesTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,4 +565,39 @@ public function testWithMultiLevelPrivateDomain(): void
565565
self::assertTrue($domain->suffix()->isPrivate());
566566
self::assertSame('lt.eu.org', $domain->suffix()->value());
567567
}
568+
569+
#[DataProvider('privateDomainWithWildcardProvider')]
570+
public function testWithPrivateDomainThatHasWildcardSubdomain(string $inputDomain, string $expectedSuffix): void
571+
{
572+
$domain = self::$rules->getPrivateDomain($inputDomain);
573+
574+
self::assertSame($expectedSuffix, $domain->suffix()->value());
575+
self::assertSame(false, $domain->suffix()->isICANN());
576+
self::assertSame(true, $domain->suffix()->isPrivate());
577+
}
578+
579+
/**
580+
* @return iterable<string, array{inputDomain: string, expectedSuffix: string}>
581+
*/
582+
public static function privateDomainWithWildcardProvider(): iterable
583+
{
584+
return [
585+
'appspot subdomain' => [
586+
'inputDomain' => 'test-domain.de.r.appspot.com',
587+
'expectedSuffix' => 'de.r.appspot.com',
588+
],
589+
'appspot root domain' => [
590+
'inputDomain' => 'test-domain.appspot.com',
591+
'expectedSuffix' => 'appspot.com',
592+
],
593+
'qcx subdomain' => [
594+
'inputDomain' => 'test-domain.de.sys.qcx.io',
595+
'expectedSuffix' => 'de.sys.qcx.io',
596+
],
597+
'qcx root domain' => [
598+
'inputDomain' => 'test-domain.qcx.io',
599+
'expectedSuffix' => 'qcx.io',
600+
],
601+
];
602+
}
568603
}

0 commit comments

Comments
 (0)