public function TrueFalseTestCase::testEditQuestionResponse in Quiz 7.5
Test that the question response can be edited.
File
- question_types/
truefalse/ truefalse.test, line 117 - Unit tests for the truefalse Module.
Class
- TrueFalseTestCase
- Test class for true false questions.
Code
public function testEditQuestionResponse() {
// Create & link a question.
$question_node = $this
->testCreateQuizQuestion();
$quiz_node = $this
->linkQuestionToQuiz($question_node);
$question_node2 = $this
->testCreateQuizQuestion();
$this
->linkQuestionToQuiz($question_node2, $quiz_node);
// Login as non-admin.
$this
->drupalLogin($this->user);
// Take the quiz.
$this
->drupalGet("node/{$quiz_node->nid}/take");
// Test editing a question.
$this
->drupalGet("node/{$quiz_node->nid}/take");
$this
->drupalGet("node/{$quiz_node->nid}/take/1");
$this
->drupalPost(NULL, array(
"question[{$question_node->nid}][answer]" => 0,
), t('Next'));
$this
->drupalGet("node/{$quiz_node->nid}/take/1");
$this
->drupalPost(NULL, array(
"question[{$question_node->nid}][answer]" => 1,
), t('Next'));
}