public function QuizResultTest::testBrokenResults in Quiz 8.6
Same name and namespace in other branches
- 8.5 tests/src/Functional/QuizResultTest.php \Drupal\Tests\quiz\Functional\QuizResultTest::testBrokenResults()
- 6.x tests/src/Functional/QuizResultTest.php \Drupal\Tests\quiz\Functional\QuizResultTest::testBrokenResults()
Test that deleting a question from a Quiz doesn't result in a fatal error.
File
- tests/
src/ Functional/ QuizResultTest.php, line 277
Class
- QuizResultTest
- Test quiz results behavior.
Namespace
Drupal\Tests\quiz\FunctionalCode
public function testBrokenResults() {
$this
->drupalLogin($this->admin);
$question1 = $this
->createQuestion(array(
'type' => 'truefalse',
'truefalse_correct' => 1,
));
$quiz_node = $this
->linkQuestionToQuiz($question1);
// Submit an answer.
$this
->drupalLogin($this->user);
$this
->drupalGet("quiz/{$quiz_node->id()}/take");
$this
->drupalPostForm(NULL, array(
"question[{$question1->id()}][answer]" => 1,
), t('Finish'));
// Delete the question.
$question1
->delete();
// And there should not be a fatal error.
$this
->drupalGet("quiz/{$quiz_node->id()}/result/1");
$this
->assertResponse(200, 'Saw the results page.');
}