You are here

function CmaWebTestCase::testAdminAccess in Chain Menu Access API 6

Same name and namespace in other branches
  1. 8 tests/chain_menu_access.test \CmaWebTestCase::testAdminAccess()
  2. 7.2 tests/chain_menu_access.test \CmaWebTestCase::testAdminAccess()
  3. 7 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/user');
  $this
    ->assertResponse(403, "Cannot normally access 'admin/user'.");
  $this
    ->drupalGet('admin/user/user');
  $this
    ->assertResponse(403, "Cannot normally access 'admin/user/user'.");
  $this
    ->drupalGet('admin/user/user/create');
  $this
    ->assertResponse(403, "Cannot normally access 'admin/user/user/create'.");
  $this
    ->drupalGet('admin', array(
    'query' => array(
      'enable_cma' => 1,
    ),
  ));
  $this
    ->assertResponse(403, "Still cannot access 'admin'.");
  $this
    ->drupalGet('admin/user', array(
    'query' => array(
      'enable_cma' => 1,
    ),
  ));
  $this
    ->assertResponse(403, "Still cannot access 'admin/user'.");
  $this
    ->drupalGet('admin/user/user', array(
    'query' => array(
      'enable_cma' => 1,
    ),
  ));
  $this
    ->assertResponse(403, "Still cannot access 'admin/user/user'.");
  $this
    ->drupalGet('admin/user/user/create', array(
    'query' => array(
      'enable_cma' => 1,
    ),
  ));
  $this
    ->assertResponse(200, "Can access 'admin/user/user/create' now. It's redirected to user/UID though, but that's caused by user_login(), which is outside of our scope.");
}