public function WebTestBaseTest::testGetAbsoluteUrl in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/tests/src/Unit/WebTestBaseTest.php \Drupal\Tests\simpletest\Unit\WebTestBaseTest::testGetAbsoluteUrl()
@dataProvider providerTestGetAbsoluteUrl
File
- core/
modules/ simpletest/ tests/ src/ Unit/ WebTestBaseTest.php, line 204 - Contains \Drupal\Tests\simpletest\Unit\WebTestBaseTest.
Class
- WebTestBaseTest
- @coversDefaultClass \Drupal\simpletest\WebTestBase @group simpletest
Namespace
Drupal\Tests\simpletest\UnitCode
public function testGetAbsoluteUrl($href, $expected_absolute_path) {
$web_test = $this
->getMockBuilder('Drupal\\simpletest\\WebTestBase')
->disableOriginalConstructor()
->setMethods([
'getUrl',
])
->getMock();
$web_test
->expects($this
->any())
->method('getUrl')
->willReturn('http://example.com/drupal/current-path?foo=baz');
$GLOBALS['base_url'] = 'http://example.com';
$GLOBALS['base_path'] = 'drupal';
$get_absolute_url_method = new \ReflectionMethod($web_test, 'getAbsoluteUrl');
$get_absolute_url_method
->setAccessible(TRUE);
$this
->assertSame($expected_absolute_path, $get_absolute_url_method
->invoke($web_test, $href));
unset($GLOBALS['base_url'], $GLOBALS['base_path']);
}