jwage /
purl
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Purl\Test; |
||
| 6 | |||
| 7 | use PHPUnit\Framework\TestCase; |
||
| 8 | use Purl\Url; |
||
| 9 | |||
| 10 | class PublicSuffixListTest extends TestCase |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @dataProvider parseDataProvider |
||
| 14 | */ |
||
| 15 | public function testPublicSuffixListImplementation( |
||
| 16 | string $url, |
||
| 17 | ?string $publicSuffix, |
||
| 18 | ?string $registerableDomain, |
||
| 19 | ?string $subdomain, |
||
| 20 | string $hostPart |
||
|
0 ignored issues
–
show
|
|||
| 21 | ) : void { |
||
| 22 | $url = new Url($url); |
||
| 23 | $this->assertEquals($subdomain, $url->subdomain); |
||
| 24 | $this->assertEquals($registerableDomain, $url->registerableDomain); |
||
| 25 | $this->assertEquals($publicSuffix, $url->publicSuffix); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @return mixed[] |
||
| 30 | */ |
||
| 31 | public function parseDataProvider() : array |
||
| 32 | { |
||
| 33 | return [ |
||
| 34 | ['http://www.waxaudio.com.au/audio/albums/the_mashening', 'com.au', 'waxaudio.com.au', 'www', 'www.waxaudio.com.au'], |
||
| 35 | ['example.COM', 'com', 'example.com', null, 'example.com'], |
||
| 36 | ['giant.yyyy', 'yyyy', 'giant.yyyy', null, 'giant.yyyy'], |
||
| 37 | ['cea-law.co.il', 'co.il', 'cea-law.co.il', null, 'cea-law.co.il'], |
||
| 38 | ['http://edition.cnn.com/WORLD/', 'com', 'cnn.com', 'edition', 'edition.cnn.com'], |
||
| 39 | ['http://en.wikipedia.org/', 'org', 'wikipedia.org', 'en', 'en.wikipedia.org'], |
||
| 40 | ['a.b.c.cy', 'c.cy', 'b.c.cy', 'a', 'a.b.c.cy'], |
||
| 41 | ['https://test.k12.ak.us', 'k12.ak.us', 'test.k12.ak.us', null, 'test.k12.ak.us'], |
||
| 42 | ['www.scottwills.co.uk', 'co.uk', 'scottwills.co.uk', 'www', 'www.scottwills.co.uk'], |
||
| 43 | ['b.ide.kyoto.jp', 'ide.kyoto.jp', 'b.ide.kyoto.jp', null, 'b.ide.kyoto.jp'], |
||
| 44 | ['a.b.example.uk.com', 'uk.com', 'example.uk.com', 'a.b', 'a.b.example.uk.com'], |
||
| 45 | ['test.nic.ar', 'ar', 'nic.ar', 'test', 'test.nic.ar'], |
||
| 46 | ['a.b.test.ck', 'test.ck', 'b.test.ck', 'a', 'a.b.test.ck'], |
||
| 47 | ['baez.songfest.om', 'om', 'songfest.om', 'baez', 'baez.songfest.om'], |
||
| 48 | ['politics.news.omanpost.om', 'om', 'omanpost.om', 'politics.news', 'politics.news.omanpost.om'], |
||
| 49 | ['us.example.com', 'com', 'example.com', 'us', 'us.example.com'], |
||
| 50 | ['us.example.na', 'na', 'example.na', 'us', 'us.example.na'], |
||
| 51 | ['www.example.us.na', 'us.na', 'example.us.na', 'www', 'www.example.us.na'], |
||
| 52 | ['us.example.org', 'org', 'example.org', 'us', 'us.example.org'], |
||
| 53 | ['webhop.broken.biz', 'biz', 'broken.biz', 'webhop', 'webhop.broken.biz'], |
||
| 54 | ['www.broken.webhop.biz', 'webhop.biz', 'broken.webhop.biz', 'www', 'www.broken.webhop.biz'], |
||
| 55 | ['//www.broken.webhop.biz', 'webhop.biz', 'broken.webhop.biz', 'www', 'www.broken.webhop.biz'], |
||
| 56 | ['ftp://www.waxaudio.com.au/audio/albums/the_mashening', 'com.au', 'waxaudio.com.au', 'www', 'www.waxaudio.com.au'], |
||
| 57 | ['ftps://test.k12.ak.us', 'k12.ak.us', 'test.k12.ak.us', null, 'test.k12.ak.us'], |
||
| 58 | ['http://localhost', null, null, null, 'localhost'], |
||
| 59 | ['test.museum', 'museum', 'test.museum', null, 'test.museum'], |
||
| 60 | ['bob.smith.name', 'name', 'smith.name', 'bob', 'bob.smith.name'], |
||
| 61 | ['tons.of.info', 'info', 'of.info', 'tons', 'tons.of.info'], |
||
| 62 | ]; |
||
| 63 | } |
||
| 64 | } |
||
| 65 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.