protected function OpignoQuizImportAppWebTestCase::_testFirstQuestionSettings in Opigno Quiz Import App 7
Helper function to test the first question settings.
1 call to OpignoQuizImportAppWebTestCase::_testFirstQuestionSettings()
- OpignoQuizImportAppWebTestCase::testGlobalImport in tests/
OpignoQuizImportAppWebTestCase.test - Test importing a quiz in global context.
File
- tests/
OpignoQuizImportAppWebTestCase.test, line 155 - 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 _testFirstQuestionSettings() {
$this
->assertFieldByName('alternatives[0][answer][value]', 'A nice chap', "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]', '', "Feedback is correctly set if chosen.");
$this
->assertFieldByName('alternatives[0][feedback_if_not_chosen][value]', 'Who do you think you are ?', "Feedback is correctly set if not chosen.");
$this
->assertFieldByName('alternatives[0][score_if_chosen]', 1, "Score was correctly set to 1 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 scientist', "The second option label is correctly set.");
$this
->assertFieldChecked('edit-alternatives-1-correct', "The first option is correctly set as correct.");
$this
->assertFieldByName('alternatives[1][feedback_if_chosen][value]', 'Everything is relative', "Feedback is correctly set if chosen.");
$this
->assertFieldByName('alternatives[1][feedback_if_not_chosen][value]', 'Wrong you are', "Feedback is correctly set if not chosen.");
$this
->assertFieldByName('alternatives[1][score_if_chosen]', 4, "Score was correctly set to 4 if chosen.");
$this
->assertFieldByName('alternatives[1][score_if_not_chosen]', 0, "Score was correctly set to 0 if not chosen.");
$this
->assertFieldByName('alternatives[2][answer][value]', 'My neighbour', "The third option label is correctly set.");
$this
->assertNoFieldChecked('edit-alternatives-2-correct', "The first option is correctly set as incorrect.");
$this
->assertFieldByName('alternatives[2][feedback_if_chosen][value]', 'I doubt it', "Feedback is correctly set if chosen.");
$this
->assertFieldByName('alternatives[2][feedback_if_not_chosen][value]', 'Of course not', "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]', 4, "Score was correctly set to 4 if not chosen.");
}