当前位置: 首页>>代码示例>>PHP>>正文


PHP test_question_maker::make_a_multichoice_single_question方法代码示例

本文整理汇总了PHP中test_question_maker::make_a_multichoice_single_question方法的典型用法代码示例。如果您正苦于以下问题:PHP test_question_maker::make_a_multichoice_single_question方法的具体用法?PHP test_question_maker::make_a_multichoice_single_question怎么用?PHP test_question_maker::make_a_multichoice_single_question使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test_question_maker的用法示例。


在下文中一共展示了test_question_maker::make_a_multichoice_single_question方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_multichoice

 public function test_multichoice()
 {
     // Create a multiple choice, single response question.
     $mc = test_question_maker::make_a_multichoice_single_question();
     $mc->penalty = 0.3333333;
     $this->start_attempt_at_question($mc, 'adaptivenopenalty', 3);
     $rightindex = $this->get_mc_right_answer_index($mc);
     $wrongindex = ($rightindex + 1) % 3;
     // 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_radio_expectation(0, true, false), $this->get_contains_mc_radio_expectation(1, true, false), $this->get_contains_mc_radio_expectation(2, true, false), $this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_feedback_expectation());
     // Process a submit.
     $this->process_submission(array('answer' => $wrongindex, '-submit' => 1));
     // Verify.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(0);
     $this->check_current_output($this->get_contains_mark_summary(0), $this->get_contains_mc_radio_expectation($wrongindex, true, true), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($wrongindex + 2) % 3, true, false), $this->get_contains_incorrect_expectation(), $this->get_does_not_contain_penalty_info_expectation(), $this->get_does_not_contain_total_penalty_expectation());
     $this->assertRegExp('/B|C/', $this->quba->get_response_summary($this->slot));
     // Process a change of answer to the right one, but not sumbitted.
     $this->process_submission(array('answer' => $rightindex));
     // Verify.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(0);
     $this->check_current_output($this->get_contains_mark_summary(0), $this->get_contains_mc_radio_expectation($rightindex, true, true), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, true, false));
     $this->assertRegExp('/B|C/', $this->quba->get_response_summary($this->slot));
     // Now submit the right answer.
     $this->process_submission(array('answer' => $rightindex, '-submit' => 1));
     // Verify.
     $this->check_current_state(question_state::$complete);
     $this->check_current_mark(3);
     $this->check_current_output($this->get_contains_mark_summary(3), $this->get_contains_mc_radio_expectation($rightindex, true, true), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, true, false), $this->get_contains_correct_expectation(), $this->get_does_not_contain_penalty_info_expectation(), $this->get_does_not_contain_total_penalty_expectation());
     $this->assertEquals('A', $this->quba->get_response_summary($this->slot));
     // Finish the attempt.
     $this->quba->finish_all_questions();
     // Verify.
     $this->check_current_state(question_state::$gradedright);
     $this->check_current_mark(3);
     $this->check_current_output($this->get_contains_mark_summary(3), $this->get_contains_mc_radio_expectation($rightindex, false, true), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, false, false), $this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, false, false), $this->get_contains_correct_expectation());
     // Process a manual comment.
     $this->manual_grade('Not good enough!', 1, FORMAT_HTML);
     // Verify.
     $this->check_current_state(question_state::$mangrpartial);
     $this->check_current_mark(1);
     $this->check_current_output($this->get_contains_mark_summary(1), new question_pattern_expectation('/' . preg_quote('Not good enough!', '/') . '/'));
     // Now change the correct answer to the question, and regrade.
     $mc->answers[13]->fraction = -0.33333333;
     $mc->answers[14]->fraction = 1;
     // We don't know which "wrong" index we chose above!
     $mc->answers[15]->fraction = 1;
     // Therefore, treat answers B and C with the same score.
     $this->quba->regrade_all_questions();
     // Verify.
     $this->check_current_state(question_state::$mangrpartial);
     $this->check_current_mark(1);
     $this->check_current_output($this->get_contains_mark_summary(1), $this->get_contains_partcorrect_expectation());
     $autogradedstep = $this->get_step($this->get_step_count() - 3);
     $this->assertEquals($autogradedstep->get_fraction(), 1, '', 1.0E-7);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:59,代码来源:walkthrough_test.php

示例2: test_adaptive_multichoice

 public function test_adaptive_multichoice()
 {
     // Create a multiple choice, single response question.
     $mc = test_question_maker::make_a_multichoice_single_question();
     $mc->penalty = 0.3333333;
     $this->start_attempt_at_question($mc, 'adaptive', 3);
     $rightindex = $this->get_mc_right_answer_index($mc);
     $wrongindex = ($rightindex + 1) % 3;
     // 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_radio_expectation(0, true, false), $this->get_contains_mc_radio_expectation(1, true, false), $this->get_contains_mc_radio_expectation(2, true, false), $this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_feedback_expectation());
     // Process a submit.
     $this->process_submission(array('answer' => $wrongindex, '-submit' => 1));
     // Verify.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(0);
     $this->check_current_output($this->get_contains_mark_summary(0), $this->get_contains_mc_radio_expectation($wrongindex, true, true), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($wrongindex + 2) % 3, true, false), $this->get_contains_incorrect_expectation());
     $this->assertPattern('/B|C/', $this->quba->get_response_summary($this->slot));
     // Process a change of answer to the right one, but not sumbitted.
     $this->process_submission(array('answer' => $rightindex));
     // Verify.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(0);
     $this->check_current_output($this->get_contains_mark_summary(0), $this->get_contains_mc_radio_expectation($rightindex, true, true), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, true, false));
     $this->assertPattern('/B|C/', $this->quba->get_response_summary($this->slot));
     // Now submit the right answer.
     $this->process_submission(array('answer' => $rightindex, '-submit' => 1));
     // Verify.
     $this->check_current_state(question_state::$complete);
     $this->check_current_mark(3 * (1 - $mc->penalty));
     $this->check_current_output($this->get_contains_mark_summary(3 * (1 - $mc->penalty)), $this->get_contains_mc_radio_expectation($rightindex, true, true), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, true, false), $this->get_contains_correct_expectation(), new PatternExpectation('/' . preg_quote(get_string('gradingdetailspenalty', 'qbehaviour_adaptive', format_float($mc->penalty, $this->displayoptions->markdp))) . '/'));
     $this->assertEqual('A', $this->quba->get_response_summary($this->slot));
     // Finish the attempt.
     $this->quba->finish_all_questions();
     // Verify.
     $this->check_current_state(question_state::$gradedright);
     $this->check_current_mark(3 * (1 - $mc->penalty));
     $this->check_current_output($this->get_contains_mark_summary(3 * (1 - $mc->penalty)), $this->get_contains_mc_radio_expectation($rightindex, false, true), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, false, false), $this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, false, false), $this->get_contains_correct_expectation());
     // Process a manual comment.
     $this->manual_grade('Not good enough!', 1);
     // Verify.
     $this->check_current_state(question_state::$mangrpartial);
     $this->check_current_mark(1);
     $this->check_current_output($this->get_contains_mark_summary(1), new PatternExpectation('/' . preg_quote('Not good enough!') . '/'));
     // Now change the correct answer to the question, and regrade.
     $mc->answers[13]->fraction = -0.33333333;
     $mc->answers[15]->fraction = 1;
     $this->quba->regrade_all_questions();
     // Verify.
     $this->check_current_state(question_state::$mangrpartial);
     $this->check_current_mark(1);
     $this->check_current_output($this->get_contains_mark_summary(1), $this->get_contains_partcorrect_expectation());
     $autogradedstep = $this->get_step($this->get_step_count() - 2);
     $this->assertWithinMargin($autogradedstep->get_fraction(), 0, 1.0E-7);
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:56,代码来源:testwalkthrough.php

示例3: test_get_question_summary

 public function test_get_question_summary()
 {
     $mc = test_question_maker::make_a_multichoice_single_question();
     $mc->start_attempt(new question_attempt_step(), 1);
     $qsummary = $mc->get_question_summary();
     $this->assertRegExp('/' . preg_quote($mc->questiontext, '/') . '/', $qsummary);
     foreach ($mc->answers as $answer) {
         $this->assertRegExp('/' . preg_quote($answer->answer, '/') . '/', $qsummary);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:10,代码来源:question_multi_test.php

示例4: test_make_html_inline

 public function test_make_html_inline()
 {
     // Base class is abstract, so we need to pick one qusetion type to test this method.
     $mc = test_question_maker::make_a_multichoice_single_question();
     $this->assertEquals('Frog', $mc->make_html_inline('<p>Frog</p>'));
     $this->assertEquals('Frog', $mc->make_html_inline('<p>Frog<br /></p>'));
     $this->assertEquals('Frog<br />Toad', $mc->make_html_inline("<p>Frog</p>\n<p>Toad</p>"));
     $this->assertEquals('<img src="http://example.com/pic.png" alt="Graph" />', $mc->make_html_inline('<p><img src="http://example.com/pic.png" alt="Graph" /></p>'));
     $this->assertEquals("Frog<br />XXX <img src='http://example.com/pic.png' alt='Graph' />", $mc->make_html_inline(" <p> Frog </p> \n\r\n                    <p> XXX <img src='http://example.com/pic.png' alt='Graph' /> </p> "));
     $this->assertEquals('Frog', $mc->make_html_inline('<p>Frog</p><p></p>'));
     $this->assertEquals('Frog<br />†', $mc->make_html_inline('<p>Frog</p><p>†</p>'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:12,代码来源:question_definition_test.php

示例5: test_deferredfeedback_feedback_multichoice_single

 public function test_deferredfeedback_feedback_multichoice_single()
 {
     // Create a multichoice, single question.
     $mc = test_question_maker::make_a_multichoice_single_question();
     $mc->shuffleanswers = false;
     $mc->answers[14]->fraction = 0.1;
     // Make one of the choices partially right.
     $rightindex = 0;
     $this->start_attempt_at_question($mc, 'deferredfeedback', 3);
     $this->process_submission(array('answer' => $rightindex));
     // Verify.
     $this->check_current_state(question_state::$complete);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_mc_radio_expectation($rightindex, true, true), $this->get_contains_mc_radio_expectation($rightindex + 1, true, false), $this->get_contains_mc_radio_expectation($rightindex + 2, true, false), $this->get_does_not_contain_correctness_expectation(), $this->get_does_not_contain_feedback_expectation());
     // Finish the attempt.
     $this->quba->finish_all_questions();
     // Verify.
     $this->check_current_state(question_state::$gradedright);
     $this->check_current_mark(3);
     $this->check_current_output($this->get_contains_mc_radio_expectation($rightindex, false, true), $this->get_contains_correct_expectation(), new question_pattern_expectation('/class="r0 correct"/'), new question_pattern_expectation('/class="r1"/'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:21,代码来源:walkthrough_test.php

示例6: test_immediatecbm_feedback_multichoice_wrong_on_finish

 public function test_immediatecbm_feedback_multichoice_wrong_on_finish()
 {
     // Create a true-false question with correct answer true.
     $mc = test_question_maker::make_a_multichoice_single_question();
     $this->start_attempt_at_question($mc, 'immediatecbm');
     // Check the initial state.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_question_text_expectation($mc), $this->get_contains_mc_radio_expectation(0, true, false), $this->get_contains_mc_radio_expectation(1, true, false), $this->get_contains_mc_radio_expectation(2, true, false), $this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_feedback_expectation());
     $rightindex = $this->get_mc_right_answer_index($mc);
     $wrongindex = ($rightindex + 1) % 3;
     // Save the wrong answer.
     $this->process_submission(array('answer' => $wrongindex, '-certainty' => 3));
     // Verify.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_mc_radio_expectation($wrongindex, true, true), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, true, false), $this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_correctness_expectation());
     // Finish the attempt.
     $this->quba->finish_all_questions();
     // Verify.
     $this->check_current_state(question_state::$gradedwrong);
     $this->check_current_mark(-6);
     $this->check_current_output($this->get_contains_mc_radio_expectation($wrongindex, false, true), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false), $this->get_contains_incorrect_expectation());
 }
开发者ID:evltuma,项目名称:moodle,代码行数:24,代码来源:walkthrough_test.php

示例7: test_simulated_post_data

 public function test_simulated_post_data()
 {
     $mc = test_question_maker::make_a_multichoice_single_question();
     $mc->shuffleanswers = false;
     $mc->answers[13]->answer = '<p>A</p>';
     $mc->answers[14]->answer = '<p>B</p>';
     $mc->answers[15]->answer = '<p>C</p>';
     $mc->start_attempt(new question_attempt_step(), 1);
     $originalresponse = array('answer' => 1);
     $simulated = $mc->get_student_response_values_for_simulation($originalresponse);
     $this->assertEquals(array('answer' => 'B'), $simulated);
     $reconstucted = $mc->prepare_simulated_post_data($simulated);
     $this->assertEquals($originalresponse, $reconstucted);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:question_single_test.php

示例8: test_deferredfeedback_resume_multichoice_single_emptyanswer_first

 public function test_deferredfeedback_resume_multichoice_single_emptyanswer_first()
 {
     // Create a multiple-choice question.
     $mc = test_question_maker::make_a_multichoice_single_question();
     // Attempt it and submit empty.
     $this->start_attempt_at_question($mc, 'deferredfeedback', 3);
     $rightindex = $this->get_mc_right_answer_index($mc);
     $wrongindex = ($rightindex + 1) % 3;
     $this->check_current_state(question_state::$todo);
     $this->check_output_contains_lang_string('notyetanswered', 'question');
     $this->check_current_mark(null);
     $this->process_submission(array('-submit' => 1));
     $this->quba->finish_all_questions();
     // Verify.
     $this->check_current_state(question_state::$gaveup);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_mc_radio_expectation(0, false, false), $this->get_contains_mc_radio_expectation(1, false, false), $this->get_contains_mc_radio_expectation(2, false, false), $this->get_contains_general_feedback_expectation($mc));
     // Save the old attempt.
     $oldqa = $this->quba->get_question_attempt($this->slot);
     // Reinitialise.
     $this->setUp();
     $this->quba->set_preferred_behaviour('deferredfeedback');
     $this->slot = $this->quba->add_question($mc, 3);
     $this->quba->start_question_based_on($this->slot, $oldqa);
     // Verify.
     $this->check_current_state(question_state::$todo);
     $this->check_output_contains_lang_string('notyetanswered', 'question');
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_mc_radio_expectation(0, true, false), $this->get_contains_mc_radio_expectation(1, true, false), $this->get_contains_mc_radio_expectation(2, true, false), $this->get_does_not_contain_feedback_expectation(), $this->get_does_not_contain_correctness_expectation());
     // Now get it wrong.
     $this->process_submission(array('answer' => $wrongindex));
     $this->quba->finish_all_questions();
     // Verify.
     $this->check_current_state(question_state::$gradedwrong);
     $this->check_current_mark(-1);
     $this->check_current_output($this->get_contains_mc_radio_expectation($wrongindex, false, true), $this->get_contains_incorrect_expectation());
     // Save the old attempt.
     $oldqa = $this->quba->get_question_attempt($this->slot);
     // Reinitialise.
     $this->setUp();
     $this->quba->set_preferred_behaviour('deferredfeedback');
     $this->slot = $this->quba->add_question($mc, 3);
     $this->quba->start_question_based_on($this->slot, $oldqa);
     // Verify.
     $this->check_current_state(question_state::$complete);
     $this->check_output_contains_lang_string('notchanged', 'question');
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_mc_radio_expectation($wrongindex, true, true), $this->get_does_not_contain_feedback_expectation(), $this->get_does_not_contain_correctness_expectation());
     // Now get it right.
     $this->process_submission(array('answer' => $rightindex));
     $this->quba->finish_all_questions();
     // Verify.
     $this->check_current_state(question_state::$gradedright);
     $this->check_current_mark(3);
     $this->check_current_output($this->get_contains_mc_radio_expectation($rightindex, false, true), $this->get_contains_correct_expectation());
 }
开发者ID:evltuma,项目名称:moodle,代码行数:56,代码来源:walkthrough_test.php

示例9: test_interactive_finish_when_try_again_showing

    public function test_interactive_finish_when_try_again_showing() {

        // Create a multichoice single question.
        $mc = test_question_maker::make_a_multichoice_single_question();
        $mc->hints = array(
            new question_hint_with_parts(0, 'This is the first hint.', FORMAT_HTML, false, false),
        );
        $this->start_attempt_at_question($mc, 'interactive');

        $rightindex = $this->get_mc_right_answer_index($mc);
        $wrongindex = ($rightindex + 1) % 3;

        // 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_radio_expectation(0, true, false),
                $this->get_contains_mc_radio_expectation(1, true, false),
                $this->get_contains_mc_radio_expectation(2, true, false),
                $this->get_contains_submit_button_expectation(true),
                $this->get_does_not_contain_feedback_expectation(),
                $this->get_tries_remaining_expectation(2),
                $this->get_no_hint_visible_expectation(),
                new question_pattern_expectation('/' .
                        preg_quote(get_string('selectone', 'qtype_multichoice'), '/') . '/'));

        // Submit the wrong answer.
        $this->process_submission(array('answer' => $wrongindex, '-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_radio_expectation($wrongindex, false, true),
                $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false),
                $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, 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'));

        // Finish the attempt.
        $this->quba->finish_all_questions();

        // Verify.
        $this->check_current_state(question_state::$gradedwrong);
        $this->check_current_mark(0);
        $this->check_current_output(
                $this->get_contains_mark_summary(0),
                $this->get_contains_mc_radio_expectation($wrongindex, false, true),
                $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false),
                $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false),
                $this->get_contains_incorrect_expectation(),
                $this->get_no_hint_visible_expectation());
    }
开发者ID:ncsu-delta,项目名称:moodle,代码行数:60,代码来源:walkthrough_test.php

示例10: test_deferredcbm_resume_multichoice_single

    public function test_deferredcbm_resume_multichoice_single() {

        // Create a multiple-choice question.
        $mc = test_question_maker::make_a_multichoice_single_question();

        // Attempt it getting it wrong.
        $this->start_attempt_at_question($mc, 'deferredcbm', 3);
        $rightindex = $this->get_mc_right_answer_index($mc);
        $wrongindex = ($rightindex + 1) % 3;
        $this->process_submission(array('answer' => $wrongindex, '-certainty' => 2));
        $this->quba->finish_all_questions();

        // Verify.
        $this->check_current_state(question_state::$gradedwrong);
        $this->check_current_mark(-3.3333333);
        $this->check_current_output(
                $this->get_contains_mc_radio_expectation($wrongindex, false, true),
                $this->get_contains_cbm_radio_expectation(2, false, true),
                $this->get_contains_incorrect_expectation());
        $this->assertEquals('A [' . question_cbm::get_string(question_cbm::HIGH) . ']',
                $this->quba->get_right_answer_summary($this->slot));
        $this->assertRegExp('/' . preg_quote($mc->questiontext) . '/',
                $this->quba->get_question_summary($this->slot));
        $this->assertRegExp('/(B|C) \[' . preg_quote(question_cbm::get_string(2)) . '\]/',
                $this->quba->get_response_summary($this->slot));

        // Save the old attempt.
        $oldqa = $this->quba->get_question_attempt($this->slot);

        // Reinitialise.
        $this->setUp();
        $this->quba->set_preferred_behaviour('deferredcbm');
        $this->slot = $this->quba->add_question($mc, 3);
        $this->quba->start_question_based_on($this->slot, $oldqa);

        // Verify.
        $this->check_current_state(question_state::$todo);
        $this->check_current_mark(null);
        $this->check_current_output(
                $this->get_contains_mc_radio_expectation($wrongindex, true, true),
                $this->get_contains_cbm_radio_expectation(2, true, true),
                $this->get_does_not_contain_feedback_expectation(),
                $this->get_does_not_contain_correctness_expectation());
        $this->assertEquals('A [' . question_cbm::get_string(question_cbm::HIGH) . ']',
                $this->quba->get_right_answer_summary($this->slot));
        $this->assertRegExp('/' . preg_quote($mc->questiontext) . '/',
                $this->quba->get_question_summary($this->slot));
        $this->assertNull($this->quba->get_response_summary($this->slot));

        // Now get it right.
        $this->process_submission(array('answer' => $rightindex, '-certainty' => 3));
        $this->quba->finish_all_questions();

        // Verify.
        $this->check_current_state(question_state::$gradedright);
        $this->check_current_mark(3);
        $this->check_current_output(
                $this->get_contains_mc_radio_expectation($rightindex, false, true),
                $this->get_contains_cbm_radio_expectation(3, false, true),
                $this->get_contains_correct_expectation());
        $this->assertRegExp('/(A) \[' . preg_quote(question_cbm::get_string(3)) . '\]/',
                $this->quba->get_response_summary($this->slot));
    }
开发者ID:ncsu-delta,项目名称:moodle,代码行数:63,代码来源:walkthrough_test.php

示例11: test_make_html_inline

 public function test_make_html_inline()
 {
     $mc = test_question_maker::make_a_multichoice_single_question();
     $this->assertEquals('Frog', $mc->make_html_inline('<p>Frog</p>'));
     $this->assertEquals('Frog<br />Toad', $mc->make_html_inline("<p>Frog</p>\n<p>Toad</p>"));
     $this->assertEquals('<img src="http://example.com/pic.png" alt="Graph" />', $mc->make_html_inline('<p><img src="http://example.com/pic.png" alt="Graph" /></p>'));
     $this->assertEquals("Frog<br />XXX <img src='http://example.com/pic.png' alt='Graph' />", $mc->make_html_inline(" <p> Frog </p> \n\r\n                    <p> XXX <img src='http://example.com/pic.png' alt='Graph' /> </p> "));
     $this->assertEquals('Frog', $mc->make_html_inline('<p>Frog</p><p></p>'));
     $this->assertEquals('Frog<br />†', $mc->make_html_inline('<p>Frog</p><p>†</p>'));
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:10,代码来源:question_single_test.php


注:本文中的test_question_maker::make_a_multichoice_single_question方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。