Source of file HrefIsRelativeTest.php
Size: 1,028 Bytes - Last Modified: 2021-12-24T06:43:44+00:00
/var/www/docs.ssmods.com/process/src/tests/HrefIsRelativeTest.php
12345678910111213141516171819202122232425262728 | <?php class HrefIsRelativeTest extends SapphireTest { public function testAbsoluteURLs() { $hrefIsRelativeMethod = new ReflectionMethod('NavigationScraperService', 'hrefIsRelative'); $hrefIsRelativeMethod->setAccessible(true); $service = new NavigationScraperService(); $this->assertFalse($hrefIsRelativeMethod->invoke($service, 'http://www.example.com/blah')); $this->assertFalse($hrefIsRelativeMethod->invoke($service, 'https://www.example.com/blah')); $this->assertFalse($hrefIsRelativeMethod->invoke($service, 'www.example.com/blah')); $this->assertFalse($hrefIsRelativeMethod->invoke($service, '//example.com/blah')); } public function testRelativeURLs() { $hrefIsRelativeMethod = new ReflectionMethod('NavigationScraperService', 'hrefIsRelative'); $hrefIsRelativeMethod->setAccessible(true); $service = new NavigationScraperService(); $this->assertTrue($hrefIsRelativeMethod->invoke($service, '/blah')); $this->assertTrue($hrefIsRelativeMethod->invoke($service, 'blah/something')); } } |