@@ -708,4 +708,41 @@ public function testResolveWithIDNAOptions(): void
708
708
[$ resolved ->getAsciiIDNAOption (), $ resolved ->getUnicodeIDNAOption ()]
709
709
);
710
710
}
711
+
712
+ /**
713
+ * @covers ::getCookieEffectiveTLD
714
+ * @covers ::getICANNEffectiveTLD
715
+ * @covers ::getPrivateEffectiveTLD
716
+ * @dataProvider effectiveTLDProvider
717
+ */
718
+ public function testEffectiveTLDResolution (string $ host , string $ cookieETLD , string $ icannETLD , string $ privateETLD ): void
719
+ {
720
+ self ::assertSame ($ cookieETLD , (string ) $ this ->rules ->getCookieEffectiveTLD ($ host ));
721
+ self ::assertSame ($ icannETLD , (string ) $ this ->rules ->getICANNEffectiveTLD ($ host ));
722
+ self ::assertSame ($ privateETLD , (string ) $ this ->rules ->getPrivateEffectiveTLD ($ host ));
723
+ }
724
+
725
+ public function effectiveTLDProvider (): iterable
726
+ {
727
+ return [
728
+ 'simple TLD ' => [
729
+ 'host ' => 'www.example.com ' ,
730
+ 'cookieETLD ' => 'com ' ,
731
+ 'icannETLD ' => 'com ' ,
732
+ 'privateETLD ' => 'com ' ,
733
+ ],
734
+ 'complex ICANN TLD ' => [
735
+ 'host ' => 'www.ulb.ac.be ' ,
736
+ 'cookieETLD ' => 'ac.be ' ,
737
+ 'icannETLD ' => 'ac.be ' ,
738
+ 'privateETLD ' => 'be ' ,
739
+ ],
740
+ 'private domain effective TLD ' => [
741
+ 'host ' => 'myblog.blogspot.com ' ,
742
+ 'cookieETLD ' => 'blogspot.com ' ,
743
+ 'icannETLD ' => 'com ' ,
744
+ 'privateETLD ' => 'blogspot.com ' ,
745
+ ],
746
+ ];
747
+ }
711
748
}
0 commit comments