You are here

function CmaWebTestCase::testAdminAccess in Chain Menu Access API 7

Same name and namespace in other branches
  1. 8 tests/chain_menu_access.test \CmaWebTestCase::testAdminAccess()
  2. 6 tests/chain_menu_access.test \CmaWebTestCase::testAdminAccess()
  3. 7.2 tests/chain_menu_access.test \CmaWebTestCase::testAdminAccess()

Test making a third-level administrative path available to anon.

File

tests/chain_menu_access.test, line 29
Tests for chain_menu_access.module.

Class

CmaWebTestCase
@file Tests for chain_menu_access.module.

Code

function testAdminAccess() {
  $this
    ->drupalGet('admin');
  $this
    ->assertResponse(403, "Cannot normally access 'admin'.");
  $this
    ->drupalGet('admin/people');
  $this
    ->assertResponse(403, "Cannot normally access 'admin/people'.");
  $this
    ->drupalGet('admin/people/create');
  $this
    ->assertResponse(403, "Cannot normally access 'admin/people/create'.");
  $this
    ->drupalGet('admin', array(
    'query' => array(
      'enable_cma' => 1,
    ),
  ));
  $this
    ->assertResponse(403, "Still cannot access 'admin'.");
  $this
    ->drupalGet('admin/people', array(
    'query' => array(
      'enable_cma' => 1,
    ),
  ));
  $this
    ->assertResponse(403, "Still cannot access 'admin/people'.");
  $this
    ->drupalGet('admin/people/create', array(
    'query' => array(
      'enable_cma' => 1,
    ),
  ));
  $this
    ->assertResponse(200, "Can access 'admin/people/create' now. It's redirected to user/UID though, but that's caused by user_register_form(), which is outside of our scope.");
}