public function QuizTakingTestCase::testViewQuestionsOutsideQuiz in Quiz 7.5
Same name and namespace in other branches
- 7.6 tests/QuizTakingTestCase.test \QuizTakingTestCase::testViewQuestionsOutsideQuiz()
Test the 'view quiz question outside of a quiz' permission.
File
- tests/
QuizTakingTestCase.test, line 208
Class
Code
public function testViewQuestionsOutsideQuiz() {
$this
->drupalLogin($this->admin);
// Resuming is default behavior.
$quiz_node = $this
->drupalCreateQuiz();
$question_node1 = $this
->drupalCreateNode(array(
'type' => 'truefalse',
'correct_answer' => 1,
));
$this
->linkQuestionToQuiz($question_node1, $quiz_node);
node_access_rebuild(FALSE);
$this
->drupalLogin($this->user);
$this
->drupalGet("node/{$question_node1->nid}");
$this
->assertResponse(403);
$user_with_privs = $this
->drupalCreateUser(array(
'view quiz question outside of a quiz',
'access quiz',
));
$this
->drupalLogin($user_with_privs);
$this
->drupalGet("node/{$question_node1->nid}");
$this
->assertResponse(200);
}