function BrowserTest::testGetAbsoluteUrl

Test Drupal\simpletest\WebTestBase::getAbsoluteUrl().

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrowserTest.php, line 32
Definition of Drupal\simpletest\Tests\BrowserTest.

Class

BrowserTest
Test internal testing framework browser.

Namespace

Drupal\simpletest\Tests

Code

function testGetAbsoluteUrl() {
  $url = 'user/login';
  $this
    ->drupalGet($url);
  $absolute = url($url, array(
    'absolute' => TRUE,
  ));
  $this
    ->assertEqual($absolute, $this->url, t('Passed and requested URL are equal.'));
  $this
    ->assertEqual($this->url, $this
    ->getAbsoluteUrl($this->url), t('Requested and returned absolute URL are equal.'));
  $this
    ->drupalPost(NULL, array(), t('Log in'));
  $this
    ->assertEqual($absolute, $this->url, t('Passed and requested URL are equal.'));
  $this
    ->assertEqual($this->url, $this
    ->getAbsoluteUrl($this->url), t('Requested and returned absolute URL are equal.'));
  $this
    ->clickLink('Create new account');
  $url = 'user/register';
  $absolute = url($url, array(
    'absolute' => TRUE,
  ));
  $this
    ->assertEqual($absolute, $this->url, t('Passed and requested URL are equal.'));
  $this
    ->assertEqual($this->url, $this
    ->getAbsoluteUrl($this->url), t('Requested and returned absolute URL are equal.'));
}