You are here

public function QuizTestBase::setUp in Quiz 6.x

Same name and namespace in other branches
  1. 8.6 tests/src/Functional/QuizTestBase.php \Drupal\Tests\quiz\Functional\QuizTestBase::setUp()
  2. 8.5 tests/src/Functional/QuizTestBase.php \Drupal\Tests\quiz\Functional\QuizTestBase::setUp()

Overrides BrowserTestBase::setUp

1 call to QuizTestBase::setUp()
QuizQuestionTestBase::setUp in tests/src/Functional/QuizQuestionTestBase.php
Set up a question test case.
1 method overrides QuizTestBase::setUp()
QuizQuestionTestBase::setUp in tests/src/Functional/QuizQuestionTestBase.php
Set up a question test case.

File

tests/src/Functional/QuizTestBase.php, line 32

Class

QuizTestBase
Base test class for Quiz questions.

Namespace

Drupal\Tests\quiz\Functional

Code

public function setUp($admin_permissions = [], $user_permissions = []) {
  parent::setUp();
  $admin_permissions[] = 'administer quiz configuration';
  $admin_permissions[] = 'administer quiz_question';
  $admin_permissions[] = 'administer quiz_result_answer';
  $admin_permissions[] = 'administer quiz_result';
  $admin_permissions[] = 'administer quiz';

  // Unevaluated results view is tied to this.
  $admin_permissions[] = 'update any quiz_result';
  if ($this->profile == 'standard') {
    $admin_permissions[] = 'use text format basic_html';
    $admin_permissions[] = 'use text format restricted_html';
    $admin_permissions[] = 'use text format full_html';
    $user_permissions[] = 'use text format basic_html';
    $user_permissions[] = 'use text format restricted_html';
  }
  $user_permissions[] = 'access quiz';
  $user_permissions[] = 'view any quiz';
  $user_permissions[] = 'view own quiz_result';
  $this->admin = $this
    ->drupalCreateUser(array_unique($admin_permissions));
  $this->user = $this
    ->drupalCreateUser(array_unique($user_permissions));
}