本文整理汇总了PHP中test_question_maker::make_a_multichoice_multi_question方法的典型用法代码示例。如果您正苦于以下问题:PHP test_question_maker::make_a_multichoice_multi_question方法的具体用法?PHP test_question_maker::make_a_multichoice_multi_question怎么用?PHP test_question_maker::make_a_multichoice_multi_question使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_question_maker
的用法示例。
在下文中一共展示了test_question_maker::make_a_multichoice_multi_question方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_deferredfeedback_feedback_multichoice_multi
public function test_deferredfeedback_feedback_multichoice_multi()
{
// Create a multichoice, multi question.
$mc = test_question_maker::make_a_multichoice_multi_question();
$mc->shuffleanswers = false;
$this->start_attempt_at_question($mc, 'deferredfeedback', 2);
$this->process_submission($mc->get_correct_response());
$this->quba->finish_all_questions();
// Verify.
$this->check_current_state(question_state::$gradedright);
$this->check_current_mark(2);
$this->check_current_output($this->get_contains_mc_checkbox_expectation('choice0', false, true), $this->get_contains_mc_checkbox_expectation('choice1', false, false), $this->get_contains_mc_checkbox_expectation('choice2', false, true), $this->get_contains_mc_checkbox_expectation('choice3', false, false), $this->get_contains_correct_expectation(), new question_pattern_expectation('/class="r0 correct"/'), new question_pattern_expectation('/class="r1"/'));
}
示例2: test_classify_response
public function test_classify_response()
{
$mc = test_question_maker::make_a_multichoice_multi_question();
$mc->shuffleanswers = false;
$mc->start_attempt(new question_attempt_step(), 1);
$this->assertEquals(array(13 => new question_classified_response(13, 'A', 0.5), 14 => new question_classified_response(14, 'B', -1.0)), $mc->classify_response(array('choice0' => 1, 'choice1' => 1)));
$this->assertEquals(array(), $mc->classify_response(array()));
}
示例3: test_multichoice2
public function test_multichoice2()
{
// Create a multiple choice, multiple response question.
$mc = test_question_maker::make_a_multichoice_multi_question();
$mc->penalty = 0.3333333;
$mc->shuffleanswers = 0;
$this->start_attempt_at_question($mc, 'adaptivenopenalty', 2);
// Check the initial state.
$this->check_current_state(question_state::$todo);
$this->check_current_mark(null);
$this->check_current_output($this->get_contains_marked_out_of_summary(), $this->get_contains_question_text_expectation($mc), $this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_feedback_expectation());
// Process a submit.
$this->process_submission(array('choice0' => 1, 'choice2' => 1, '-submit' => 1));
// Verify.
$this->check_current_state(question_state::$complete);
$this->check_current_mark(2);
$this->check_current_output($this->get_contains_mark_summary(2), $this->get_contains_submit_button_expectation(true), $this->get_contains_correct_expectation(), $this->get_does_not_contain_penalty_info_expectation(), $this->get_does_not_contain_total_penalty_expectation());
// Save the same correct answer again. Should no do anything.
$numsteps = $this->get_step_count();
$this->process_submission(array('choice0' => 1, 'choice2' => 1));
// Verify.
$this->check_step_count($numsteps);
$this->check_current_state(question_state::$complete);
// Finish the attempt.
$this->quba->finish_all_questions();
// Verify.
$this->check_step_count($numsteps + 1);
$this->check_current_state(question_state::$gradedright);
$this->check_current_mark(2);
$this->check_current_output($this->get_contains_mark_summary(2), $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation());
}
示例4: test_interactive_feedback_multichoice_multiple_reset
public function test_interactive_feedback_multichoice_multiple_reset() {
// Create a multichoice multiple question.
$mc = test_question_maker::make_a_multichoice_multi_question();
$mc->hints = array(
new question_hint_with_parts(0, 'This is the first hint.', FORMAT_HTML, true, true),
new question_hint_with_parts(0, 'This is the second hint.', FORMAT_HTML, true, true),
);
$this->start_attempt_at_question($mc, 'interactive', 2);
$right = array_keys($mc->get_correct_response());
$wrong = array_diff(array('choice0', 'choice1', 'choice2', 'choice3'), $right);
$wrong = array_values(array_diff(
array('choice0', 'choice1', 'choice2', 'choice3'), $right));
// Check the initial state.
$this->check_current_state(question_state::$todo);
$this->check_current_mark(null);
$this->check_current_output(
$this->get_contains_marked_out_of_summary(),
$this->get_contains_question_text_expectation($mc),
$this->get_contains_mc_checkbox_expectation('choice0', true, false),
$this->get_contains_mc_checkbox_expectation('choice1', true, false),
$this->get_contains_mc_checkbox_expectation('choice2', true, false),
$this->get_contains_mc_checkbox_expectation('choice3', true, false),
$this->get_contains_submit_button_expectation(true),
$this->get_does_not_contain_feedback_expectation(),
$this->get_does_not_contain_num_parts_correct(),
$this->get_tries_remaining_expectation(3),
$this->get_no_hint_visible_expectation(),
new question_pattern_expectation('/' .
preg_quote(get_string('selectmulti', 'qtype_multichoice'), '/') . '/'));
// Submit an answer with one right, and one wrong.
$this->process_submission(array($right[0] => 1, $wrong[0] => 1, '-submit' => 1));
// Verify.
$this->check_current_state(question_state::$todo);
$this->check_current_mark(null);
$this->check_current_output(
$this->get_contains_marked_out_of_summary(),
$this->get_contains_mc_checkbox_expectation($right[0], false, true),
$this->get_contains_mc_checkbox_expectation($right[1], false, false),
$this->get_contains_mc_checkbox_expectation($wrong[0], false, true),
$this->get_contains_mc_checkbox_expectation($wrong[1], false, false),
$this->get_contains_submit_button_expectation(false),
$this->get_contains_try_again_button_expectation(true),
$this->get_does_not_contain_correctness_expectation(),
new question_pattern_expectation('/' .
preg_quote(get_string('notcomplete', 'qbehaviour_interactive')) . '/'),
$this->get_contains_hint_expectation('This is the first hint'),
$this->get_contains_num_parts_correct(1),
$this->get_contains_standard_incorrect_combined_feedback_expectation(),
$this->get_contains_hidden_expectation(
$this->quba->get_field_prefix($this->slot) . $right[0], '1'),
$this->get_does_not_contain_hidden_expectation(
$this->quba->get_field_prefix($this->slot) . $right[1]),
$this->get_contains_hidden_expectation(
$this->quba->get_field_prefix($this->slot) . $wrong[0], '0'),
$this->get_does_not_contain_hidden_expectation(
$this->quba->get_field_prefix($this->slot) . $wrong[1]));
// Do try again.
$this->process_submission(array($right[0] => 1, '-tryagain' => 1));
// Verify.
$this->check_current_state(question_state::$todo);
$this->check_current_mark(null);
$this->check_current_output(
$this->get_contains_marked_out_of_summary(),
$this->get_contains_mc_checkbox_expectation($right[0], true, true),
$this->get_contains_mc_checkbox_expectation($right[1], true, false),
$this->get_contains_mc_checkbox_expectation($wrong[0], true, false),
$this->get_contains_mc_checkbox_expectation($wrong[1], true, false),
$this->get_contains_submit_button_expectation(true),
$this->get_does_not_contain_correctness_expectation(),
$this->get_does_not_contain_feedback_expectation(),
$this->get_tries_remaining_expectation(2),
$this->get_no_hint_visible_expectation());
}
示例5: test_prepare_simulated_post_data
public function test_prepare_simulated_post_data()
{
$mc = test_question_maker::make_a_multichoice_multi_question();
$mc->start_attempt(new question_attempt_step(), 1);
$correctanswers = array(array(), array('A' => 1), array('B' => 1, 'D' => 0), array('A' => 0, 'B' => 0, 'C' => 0, 'D' => 0), array('A' => 1, 'B' => 0, 'C' => 1, 'D' => 0), array('A' => 1, 'B' => 0, 'C' => 1, 'D' => 1), array('A' => 1, 'B' => 1, 'C' => 1, 'D' => 1));
foreach ($correctanswers as $correctanswer) {
$postdata = $mc->prepare_simulated_post_data($correctanswer);
$simulatedreponse = $mc->get_student_response_values_for_simulation($postdata);
$this->assertEquals($correctanswer, $simulatedreponse, '', 0, 10, true);
}
}