You are here

public function AnswersTestCase::testDefaultPermissions in Answers 7.4

Same name and namespace in other branches
  1. 7.3 answers.test \AnswersTestCase::testDefaultPermissions()

Tests permissions for default roles.

File

./answers.test, line 91
Tests for answers.module.

Class

AnswersTestCase
Tests the functionality of the answers module.

Code

public function testDefaultPermissions() {
  $admin = $this
    ->drupalCreateUser(array(
    'administer permissions',
  ));
  $this
    ->drupalLogin($admin);
  $this
    ->drupalGet('admin/people/permissions');

  // Authenticated Users.
  $this
    ->assertFieldChecked('edit-2-create-answers-question-content', "Authenticated role has create question.");
  $this
    ->assertFieldChecked('edit-2-edit-own-answers-question-content', "Authenticated role has edit own question.");
  $this
    ->assertFieldChecked('edit-2-create-answers-answer-content', "Authenticated role has create answer`.");
  $this
    ->assertFieldChecked('edit-2-edit-own-answers-answer-content', "Authenticated role has edit own answer`.");

  // Administrators.
  $this
    ->assertFieldChecked('edit-3-create-answers-question-content', "Administrators role have create question.");
  $this
    ->assertFieldChecked('edit-3-edit-own-answers-question-content', "Administrators role has edit own question.");
  $this
    ->assertFieldChecked('edit-3-edit-any-answers-question-content', "Administrators role has edit any question.");
  $this
    ->assertFieldChecked('edit-3-delete-own-answers-question-content', "Administrators role has delete own question.");
  $this
    ->assertFieldChecked('edit-3-delete-any-answers-question-content', "Administrators role has delete any question.");
  $this
    ->assertFieldChecked('edit-3-create-answers-answer-content', "Administrators role has create answer.");
  $this
    ->assertFieldChecked('edit-3-edit-own-answers-answer-content', "Administrators role has edit own answer.");
  $this
    ->assertFieldChecked('edit-3-edit-any-answers-question-content', "Administrators role has edit any answer.");
  $this
    ->assertFieldChecked('edit-3-delete-own-answers-answer-content', "Administrators role has delete own answer.");
  $this
    ->assertFieldChecked('edit-3-delete-any-answers-answer-content', "Administrators role has delete any answer.");
}