public function test_has_var() {
     $step = new question_attempt_step(array('x' => 1, '-y' => 'frog'));
     $this->assertTrue($step->has_qt_var('x'));
     $this->assertTrue($step->has_behaviour_var('y'));
     $this->assertFalse($step->has_qt_var('y'));
     $this->assertFalse($step->has_behaviour_var('x'));
 }
Example #2
0
 protected function prepare_response($name, question_attempt $qa, question_attempt_step $step, $context)
 {
     if (!$step->has_qt_var($name)) {
         return '';
     }
     $formatoptions = new stdClass();
     $formatoptions->para = false;
     $text = $qa->rewrite_response_pluginfile_urls($step->get_qt_var($name), $context->id, 'answer', $step);
     return format_text($text, $step->get_qt_var($name . 'format'), $formatoptions);
 }