You are here

protected function AccessFilterResrictionTestCase::assertAccess in Access Filter 7

Check restriction to access works correctly.

Parameters

string $path: A string of path to access.

int $code: An integer of HTTP status code.

string $message: A string of assert message.

Return value

bool TRUE if the assertion succeeded, FALSE otherwise.

1 call to AccessFilterResrictionTestCase::assertAccess()
AccessFilterResrictionTestCase::testRestrictionAccess in ./access_filter.test
Test filter restriction functions.

File

./access_filter.test, line 307
Tests for access_filter.module

Class

AccessFilterResrictionTestCase

Code

protected function assertAccess($path, $code, $message) {

  // Build absolute url to avoid auto looking up aliases.
  global $base_url;
  $url = $base_url . '/';
  if (!empty($GLOBALS['conf']['clean_url'])) {
    $url .= $path;
  }
  else {
    $url .= '?q=' . $path;
  }

  // Disable redirection to assert 301/302 codes.
  $max_redirects = variable_get('simpletest_maximum_redirects', 5);
  variable_set('simpletest_maximum_redirects', 0);
  $this
    ->drupalGet($url);
  variable_set('simpletest_maximum_redirects', $max_redirects);
  return $this
    ->assertResponse($code, $message);
}