You are here

function SimpleTestURLTestCase::testGetAbsoluteUrl in SimpleTest 7

Same name and namespace in other branches
  1. 7.2 simpletest.test \SimpleTestURLTestCase::testGetAbsoluteUrl()

Test DrupalWebTestCase::getAbsoluteUrl().

File

./simpletest.test, line 287

Class

SimpleTestURLTestCase
Test internal testing framework URL handling.

Code

function testGetAbsoluteUrl() {

  // Testbed runs with Clean URLs disabled, so disable it here.
  variable_set('clean_url', 0);
  $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.'));
}