protected function OpignoQuizImportAppWebTestCase::_testSecondQuestionSettings in Opigno Quiz Import App 7
Helper function to test the second question settings.
1 call to OpignoQuizImportAppWebTestCase::_testSecondQuestionSettings()
- OpignoQuizImportAppWebTestCase::testGlobalImport in tests/
OpignoQuizImportAppWebTestCase.test - Test importing a quiz in global context.
File
- tests/
OpignoQuizImportAppWebTestCase.test, line 121 - Defines the unit tests for the Opigno Quiz Import app.
Class
- OpignoQuizImportAppWebTestCase
- @file Defines the unit tests for the Opigno Quiz Import app.
Code
protected function _testSecondQuestionSettings() {
$default_score_not_chosen = -1;
// Value from multichoice.
$this
->assertFieldByName('alternatives[0][answer][value]', 'A guy', "The first option label is correctly set.");
$this
->assertFieldChecked('edit-alternatives-0-correct', "The first option is correctly set as correct.");
$this
->assertFieldByName('alternatives[0][feedback_if_chosen][value]', 'Hard to disagree with that', "Feedback is correctly set if chosen.");
$this
->assertFieldByName('alternatives[0][feedback_if_not_chosen][value]', 'Sigh', "Feedback is correctly set if not chosen.");
$this
->assertFieldByName('alternatives[0][score_if_chosen]', 3, "Score was correctly set to 3 if chosen.");
$this
->assertFieldByName('alternatives[0][score_if_not_chosen]', 0, "Score was correctly set to 0 if not chosen.");
$this
->assertFieldByName('alternatives[1][answer][value]', 'A gall', "The second option label is correctly set.");
$this
->assertNoFieldChecked('edit-alternatives-1-correct', "The first option is correctly set as correct.");
$this
->assertFieldByName('alternatives[1][feedback_if_chosen][value]', '"Albert"…', "Feedback is correctly set if chosen.");
$this
->assertFieldByName('alternatives[1][feedback_if_not_chosen][value]', "Don't brag", "Feedback is correctly set if not chosen.");
$this
->assertFieldByName('alternatives[1][score_if_chosen]', 0, "Score was correctly set to 0 if chosen.");
$this
->assertFieldByName('alternatives[1][score_if_not_chosen]', 2, "Score was correctly set to 2 if not chosen.");
$this
->assertFieldByName('alternatives[2][answer][value]', 'A brilliant scientist', "The third option label is correctly set.");
$this
->assertFieldChecked('edit-alternatives-2-correct', "The first option is correctly set as incorrect.");
$this
->assertFieldByName('alternatives[2][feedback_if_chosen][value]', '', "Feedback is correctly set if chosen.");
$this
->assertFieldByName('alternatives[2][feedback_if_not_chosen][value]', '', "Feedback is correctly set if not chosen.");
$this
->assertFieldByName('alternatives[2][score_if_chosen]', 5, "Score was correctly set to 5 if chosen.");
$this
->assertFieldByName('alternatives[2][score_if_not_chosen]', 0, "Score was correctly set to 0 if not chosen.");
$this
->assertFieldByName('alternatives[3][answer][value]', 'A lawyer', "The fourth option label is correctly set.");
$this
->assertNoFieldChecked('edit-alternatives-3-correct', "The first option is correctly set as incorrect.");
$this
->assertFieldByName('alternatives[3][feedback_if_chosen][value]', '', "Feedback is correctly set if chosen.");
$this
->assertFieldByName('alternatives[3][feedback_if_not_chosen][value]', '', "Feedback is correctly set if not chosen.");
$this
->assertFieldByName('alternatives[3][score_if_chosen]', $default_score_not_chosen, "Score was correctly set to {$default_score_not_chosen} if chosen.");
$this
->assertFieldByName('alternatives[3][score_if_not_chosen]', 0, "Score was correctly set to 0 if not chosen.");
}