| Línea 89... |
Línea 89... |
| 89 |
/**
|
89 |
/**
|
| 90 |
* Test the preview action url from the helper class.
|
90 |
* Test the preview action url from the helper class.
|
| 91 |
*
|
91 |
*
|
| 92 |
* @covers ::question_preview_action_url
|
92 |
* @covers ::question_preview_action_url
|
| 93 |
*/
|
93 |
*/
|
| 94 |
public function test_question_preview_action_url() {
|
94 |
public function test_question_preview_action_url(): void {
|
| 95 |
$actionurl = helper::question_preview_action_url($this->questiondata->id, $this->quba->get_id(), $this->options,
|
95 |
$actionurl = helper::question_preview_action_url($this->questiondata->id, $this->quba->get_id(), $this->options,
|
| 96 |
$this->context, $this->returnurl, question_preview_options::ALWAYS_LATEST);
|
96 |
$this->context, $this->returnurl, question_preview_options::ALWAYS_LATEST);
|
| 97 |
$params = [
|
97 |
$params = [
|
| 98 |
'id' => $this->questiondata->id,
|
98 |
'id' => $this->questiondata->id,
|
| 99 |
'previewid' => $this->quba->get_id(),
|
99 |
'previewid' => $this->quba->get_id(),
|
| Línea 109... |
Línea 109... |
| 109 |
/**
|
109 |
/**
|
| 110 |
* Test the preview action url from the helper class when no restartversion is passed.
|
110 |
* Test the preview action url from the helper class when no restartversion is passed.
|
| 111 |
*
|
111 |
*
|
| 112 |
* @covers ::question_preview_action_url
|
112 |
* @covers ::question_preview_action_url
|
| 113 |
*/
|
113 |
*/
|
| 114 |
public function test_question_preview_action_url_no_restartversion() {
|
114 |
public function test_question_preview_action_url_no_restartversion(): void {
|
| 115 |
$actionurl = helper::question_preview_action_url($this->questiondata->id, $this->quba->get_id(), $this->options,
|
115 |
$actionurl = helper::question_preview_action_url($this->questiondata->id, $this->quba->get_id(), $this->options,
|
| 116 |
$this->context, $this->returnurl);
|
116 |
$this->context, $this->returnurl);
|
| 117 |
$params = [
|
117 |
$params = [
|
| 118 |
'id' => $this->questiondata->id,
|
118 |
'id' => $this->questiondata->id,
|
| 119 |
'previewid' => $this->quba->get_id(),
|
119 |
'previewid' => $this->quba->get_id(),
|
| Línea 128... |
Línea 128... |
| 128 |
/**
|
128 |
/**
|
| 129 |
* Test the preview form url from the helper class.
|
129 |
* Test the preview form url from the helper class.
|
| 130 |
*
|
130 |
*
|
| 131 |
* @covers ::question_preview_form_url
|
131 |
* @covers ::question_preview_form_url
|
| 132 |
*/
|
132 |
*/
|
| 133 |
public function test_question_preview_form_url() {
|
133 |
public function test_question_preview_form_url(): void {
|
| 134 |
$formurl = helper::question_preview_form_url(
|
134 |
$formurl = helper::question_preview_form_url(
|
| 135 |
$this->questiondata->id, $this->context, $this->quba->get_id(), $this->returnurl);
|
135 |
$this->questiondata->id, $this->context, $this->quba->get_id(), $this->returnurl);
|
| 136 |
$params = [
|
136 |
$params = [
|
| 137 |
'id' => $this->questiondata->id,
|
137 |
'id' => $this->questiondata->id,
|
| 138 |
'previewid' => $this->quba->get_id(),
|
138 |
'previewid' => $this->quba->get_id(),
|
| Línea 146... |
Línea 146... |
| 146 |
/**
|
146 |
/**
|
| 147 |
* Test the preview url from the helper class.
|
147 |
* Test the preview url from the helper class.
|
| 148 |
*
|
148 |
*
|
| 149 |
* @covers ::question_preview_url
|
149 |
* @covers ::question_preview_url
|
| 150 |
*/
|
150 |
*/
|
| 151 |
public function test_question_preview_url() {
|
151 |
public function test_question_preview_url(): void {
|
| 152 |
$previewurl = helper::question_preview_url($this->questiondata->id, $this->options->behaviour, $this->options->maxmark,
|
152 |
$previewurl = helper::question_preview_url($this->questiondata->id, $this->options->behaviour, $this->options->maxmark,
|
| 153 |
$this->options, $this->options->variant, $this->context, null, question_preview_options::ALWAYS_LATEST);
|
153 |
$this->options, $this->options->variant, $this->context, null, question_preview_options::ALWAYS_LATEST);
|
| 154 |
$params = [
|
154 |
$params = [
|
| 155 |
'id' => $this->questiondata->id,
|
155 |
'id' => $this->questiondata->id,
|
| 156 |
'behaviour' => $this->options->behaviour,
|
156 |
'behaviour' => $this->options->behaviour,
|
| Línea 174... |
Línea 174... |
| 174 |
/**
|
174 |
/**
|
| 175 |
* Test the preview url from the helper class.
|
175 |
* Test the preview url from the helper class.
|
| 176 |
*
|
176 |
*
|
| 177 |
* @covers ::question_preview_url
|
177 |
* @covers ::question_preview_url
|
| 178 |
*/
|
178 |
*/
|
| 179 |
public function test_question_preview_url_no_restartversion() {
|
179 |
public function test_question_preview_url_no_restartversion(): void {
|
| 180 |
$previewurl = helper::question_preview_url($this->questiondata->id, $this->options->behaviour, $this->options->maxmark,
|
180 |
$previewurl = helper::question_preview_url($this->questiondata->id, $this->options->behaviour, $this->options->maxmark,
|
| 181 |
$this->options, $this->options->variant, $this->context, null);
|
181 |
$this->options, $this->options->variant, $this->context, null);
|
| 182 |
$params = [
|
182 |
$params = [
|
| 183 |
'id' => $this->questiondata->id,
|
183 |
'id' => $this->questiondata->id,
|
| 184 |
'behaviour' => $this->options->behaviour,
|
184 |
'behaviour' => $this->options->behaviour,
|
| Línea 200... |
Línea 200... |
| 200 |
/**
|
200 |
/**
|
| 201 |
* Test the preview comment callback if available.
|
201 |
* Test the preview comment callback if available.
|
| 202 |
*
|
202 |
*
|
| 203 |
* @covers ::get_preview_extra_elements
|
203 |
* @covers ::get_preview_extra_elements
|
| 204 |
*/
|
204 |
*/
|
| 205 |
public function test_get_preview_extra_elements() {
|
205 |
public function test_get_preview_extra_elements(): void {
|
| 206 |
global $PAGE;
|
206 |
global $PAGE;
|
| 207 |
$PAGE->set_url('/');
|
207 |
$PAGE->set_url('/');
|
| Línea 208... |
Línea 208... |
| 208 |
|
208 |
|
| 209 |
$question = \question_bank::load_question($this->questiondata->id);
|
209 |
$question = \question_bank::load_question($this->questiondata->id);
|
| Línea 218... |
Línea 218... |
| 218 |
/**
|
218 |
/**
|
| 219 |
* Test method load_versions().
|
219 |
* Test method load_versions().
|
| 220 |
*
|
220 |
*
|
| 221 |
* @covers ::load_versions
|
221 |
* @covers ::load_versions
|
| 222 |
*/
|
222 |
*/
|
| 223 |
public function test_load_versions() {
|
223 |
public function test_load_versions(): void {
|
| 224 |
$this->resetAfterTest();
|
224 |
$this->resetAfterTest();
|
| Línea 225... |
Línea 225... |
| 225 |
|
225 |
|
| 226 |
$generator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
226 |
$generator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
| 227 |
$qcat1 = $generator->create_question_category(['name' => 'My category', 'sortorder' => 1, 'idnumber' => 'myqcat']);
|
227 |
$qcat1 = $generator->create_question_category(['name' => 'My category', 'sortorder' => 1, 'idnumber' => 'myqcat']);
|