1 simpletest.test SimpleTestBrowserTestCase::testGetAbsoluteUrl()

Test BackdropWebTestCase::getAbsoluteUrl().

File

core/modules/simpletest/tests/simpletest.test, line 367
Tests for simpletest.module.

Class

SimpleTestBrowserTestCase
Test internal testing framework browser.

Code

function testGetAbsoluteUrl() {
  // Testbed runs with Clean URLs disabled, so disable it here.
  config_set('system.core', 'clean_url', 0);
  backdrop_static_reset('url');
  $url = 'user/login';

  $this->backdropGet($url);
  $absolute = url($url, 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->backdropPost(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');
  $url = 'user/register';
  $absolute = url($url, 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.');
}