You are here

class CmaWebTestCase in Chain Menu Access API 8

Same name and namespace in other branches
  1. 6 tests/chain_menu_access.test \CmaWebTestCase
  2. 7.2 tests/chain_menu_access.test \CmaWebTestCase
  3. 7 tests/chain_menu_access.test \CmaWebTestCase

@file Tests for chain_menu_access.module.

Hierarchy

Expanded class hierarchy of CmaWebTestCase

File

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

View source
class CmaWebTestCase extends DrupalWebTestCase {
  protected $web_user;
  public static function getInfo() {
    return array(
      'name' => 'Chain Menu Access API',
      'description' => 'Test altering menu access via chained access functions.',
      'group' => 'Chain Menu Access API',
    );
  }
  function setUp() {
    parent::setUp('chain_menu_access', 'chain_menu_access_test');

    //, 'devel');
    $this->web_user = $this
      ->drupalCreateUser(array(
      'create page content',
    ));

    //, 'access devel information'));
    $this
      ->drupalLogin($this->web_user);
  }

  /**
   * Test making a third-level administrative path available to anon.
   */
  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.");
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CmaWebTestCase::$web_user protected property
CmaWebTestCase::getInfo public static function
CmaWebTestCase::setUp function
CmaWebTestCase::testAdminAccess function Test making a third-level administrative path available to anon.