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


PHP test_question_maker::make_a_shortanswer_question方法代码示例

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


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

示例1: test_adaptive_shortanswer_try_to_submit_blank

    public function test_adaptive_shortanswer_try_to_submit_blank() {

        // Create a short answer question with correct answer true.
        $sa = test_question_maker::make_a_shortanswer_question();
        $this->start_attempt_at_question($sa, 'adaptive');

        // 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_submit_button_expectation(true),
                $this->get_does_not_contain_feedback_expectation());

        // Submit with blank answer.
        $this->process_submission(array('-submit' => 1, 'answer' => ''));

        // Verify.
        $this->check_current_state(question_state::$invalid);
        $this->check_current_mark(null);
        $this->check_current_output(
                $this->get_contains_marked_out_of_summary(),
                $this->get_contains_submit_button_expectation(true),
                $this->get_does_not_contain_correctness_expectation(),
                $this->get_contains_validation_error_expectation());
        $this->assertNull($this->quba->get_response_summary($this->slot));

        // Now get it wrong.
        $this->process_submission(array('-submit' => 1, 'answer' => 'toad'));

        // Verify.
        $this->check_current_state(question_state::$todo);
        $this->check_current_mark(0.8);
        $this->check_current_output(
                $this->get_contains_mark_summary(0.8),
                $this->get_contains_submit_button_expectation(true),
                $this->get_contains_partcorrect_expectation(),
                $this->get_does_not_contain_validation_error_expectation());

        // Now submit blank again.
        $this->process_submission(array('-submit' => 1, 'answer' => ''));

        // Verify.
        $this->check_current_state(question_state::$invalid);
        $this->check_current_mark(0.8);
        $this->check_current_output(
                $this->get_contains_mark_summary(0.8),
                $this->get_contains_submit_button_expectation(true),
                $this->get_contains_partcorrect_expectation(),
                $this->get_contains_validation_error_expectation());
    }
开发者ID:nottmoo,项目名称:moodle,代码行数:51,代码来源:testwalkthrough.php

示例2: test_immediatecbm_feedback_shortanswer_try_to_submit_no_certainty

 public function test_immediatecbm_feedback_shortanswer_try_to_submit_no_certainty()
 {
     // Create a short answer question with correct answer true.
     $sa = test_question_maker::make_a_shortanswer_question();
     $this->start_attempt_at_question($sa, 'immediatecbm');
     // Check the initial state.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_feedback_expectation());
     // Submit with certainty missing.
     $this->process_submission(array('-submit' => 1, 'answer' => 'frog'));
     // Verify.
     $this->check_current_state(question_state::$invalid);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_validation_error_expectation());
     // Now get it right.
     $this->process_submission(array('-submit' => 1, 'answer' => 'frog', '-certainty' => 3));
     // Verify.
     $this->check_current_state(question_state::$gradedright);
     $this->check_current_mark(1);
     $this->check_current_output($this->get_does_not_contain_validation_error_expectation());
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:22,代码来源:testwalkthrough.php

示例3: test_classify_response

 public function test_classify_response()
 {
     $sa = test_question_maker::make_a_shortanswer_question();
     $sa->start_attempt(new question_attempt_step(), 1);
     $this->assertEqual(array(new question_classified_response(13, 'frog', 1.0)), $sa->classify_response(array('answer' => 'frog')));
     $this->assertEqual(array(new question_classified_response(14, 'toad', 0.8)), $sa->classify_response(array('answer' => 'toad')));
     $this->assertEqual(array(new question_classified_response(15, 'cat', 0.0)), $sa->classify_response(array('answer' => 'cat')));
     $this->assertEqual(array(question_classified_response::no_response()), $sa->classify_response(array('answer' => '')));
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:9,代码来源:testquestion.php

示例4: test_interactive_regrade_changing_num_tries_finished

 public function test_interactive_regrade_changing_num_tries_finished()
 {
     // Create a multichoice multiple question.
     $q = test_question_maker::make_a_shortanswer_question();
     $q->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($q, 'interactive', 3);
     // Check the initial state.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_tries_remaining_expectation(3));
     // Submit the right answer.
     $this->process_submission(array('answer' => 'frog', '-submit' => 1));
     // Verify.
     $this->check_current_state(question_state::$gradedright);
     $this->check_current_mark(3);
     // Now change the quiestion so that answer is only partially right, and regrade.
     $q->answers[13]->fraction = 0.6666666999999999;
     $q->answers[14]->fraction = 1;
     $this->quba->regrade_all_questions(true);
     // Verify.
     $this->check_current_state(question_state::$gradedpartial);
     // TODO I don't think 1 is the right fraction here. However, it is what
     // you get attempting a question like this without regrading being involved,
     // and I am currently interested in testing regrading here.
     $this->check_current_mark(1);
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:26,代码来源:testwalkthrough.php


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