function BrowserTest::testGetAbsoluteUrl in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/Tests/BrowserTest.php \Drupal\simpletest\Tests\BrowserTest::testGetAbsoluteUrl()
Test \Drupal\simpletest\WebTestBase::getAbsoluteUrl().
File
- core/
modules/ simpletest/ src/ Tests/ BrowserTest.php, line 45 - Contains \Drupal\simpletest\Tests\BrowserTest.
Class
- BrowserTest
- Tests the internal browser of the testing framework.
Namespace
Drupal\simpletest\TestsCode
function testGetAbsoluteUrl() {
$url = 'user/login';
$this
->drupalGet($url);
$absolute = \Drupal::url('user.login', array(), array(
'absolute' => TRUE,
));
$this
->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.');
$this
->assertEqual($this->url, $this
->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.');
$this
->drupalPostForm(NULL, array(), t('Log in'));
$this
->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.');
$this
->assertEqual($this->url, $this
->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.');
$this
->clickLink('Create new account');
$absolute = \Drupal::url('user.register', array(), array(
'absolute' => TRUE,
));
$this
->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.');
$this
->assertEqual($this->url, $this
->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.');
}