class ChecklistapiWebTestCase

Functional tests for Checklist API.

@todo Add tests for vertical tabs progress indicators. @todo Add tests for saving and retrieving checklist progress. @todo Add tests for clearing saved progress.

Hierarchy

Expanded class hierarchy of ChecklistapiWebTestCase

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
ChecklistapiWebTestCase::$privilegedUser protected property
ChecklistapiWebTestCase::getInfo public static function
ChecklistapiWebTestCase::setUp public function
ChecklistapiWebTestCase::testAccessChecklist public function Test checklist access.
ChecklistapiWebTestCase::testChecklistComposition public function Test checklist composition.

File

modules/contrib/checklistapi/tests/checklistapi.test, line 64
Tests for Checklist API module.

View source
class ChecklistapiWebTestCase extends DrupalWebTestCase {
  protected $privilegedUser;

  public static function getInfo() {
    return array(
      'name' => 'Functional tests',
      'description' => 'Test the functionality of Checklist API.',
      'group' => 'Checklist API',
    );
  }

  public function setUp() {
    parent::setUp('checklistapi_example');
    $permissions = array('edit any checklistapi checklist');
    $this->privilegedUser = $this->drupalCreateUser($permissions);
    $this->drupalLogin($this->privilegedUser);
  }

  /**
   * Test checklist access.
   */
  public function testAccessChecklist() {
    $this->drupalGet('admin/config/development/checklistapi-example');
    $this->assertResponse(200, 'Granted access to user with "edit any checklistapi checklist" permission.');

    $permissions = array('edit example_checklist checklistapi checklist');
    $semi_privileged_user = $this->drupalCreateUser($permissions);
    $this->drupalLogin($semi_privileged_user);
    $this->drupalGet('admin/config/development/checklistapi-example');
    $this->assertResponse(200, 'Granted access to user with checklist-specific permission.');

    $this->drupalLogout();
    $this->drupalGet('admin/config/development/checklistapi-example');
    $this->assertResponse(403, 'Denied access to nonprivileged user.');
  }

  /**
   * Test checklist composition.
   */
  public function testChecklistComposition() {
    $menu_item = menu_get_item('admin/config/development/checklistapi-example');
    $this->assertEqual($menu_item['path'], 'admin/config/development/checklistapi-example', 'Created per-checklist menu item.');

    $permissions = array('edit example_checklist checklistapi checklist');
    $this->assertTrue($this->checkPermissions($permissions), 'Created per-checklist permission.');

    $this->drupalGet('admin/config/development/checklistapi-example');
    $this->assertRaw('id="block-system-help"', 'Created per-checklist help block.');
  }

}