本文整理匯總了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());
}
示例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());
}
示例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' => '')));
}
示例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);
}