| Línea 87... |
Línea 87... |
| 87 |
/**
|
87 |
/**
|
| 88 |
* Test question_remove_stale_questions_from_category function.
|
88 |
* Test question_remove_stale_questions_from_category function.
|
| 89 |
*
|
89 |
*
|
| 90 |
* @covers ::question_remove_stale_questions_from_category
|
90 |
* @covers ::question_remove_stale_questions_from_category
|
| 91 |
*/
|
91 |
*/
|
| 92 |
public function test_question_remove_stale_questions_from_category() {
|
92 |
public function test_question_remove_stale_questions_from_category(): void {
|
| 93 |
global $DB;
|
93 |
global $DB;
|
| Línea 94... |
Línea 94... |
| 94 |
|
94 |
|
| 95 |
$qcat1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
95 |
$qcat1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
| 96 |
$q1a = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcat1->id]); // Will be hidden.
|
96 |
$q1a = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcat1->id]); // Will be hidden.
|
| Línea 150... |
Línea 150... |
| 150 |
* Test delete top category in function question_can_delete_cat.
|
150 |
* Test delete top category in function question_can_delete_cat.
|
| 151 |
*
|
151 |
*
|
| 152 |
* @covers ::question_can_delete_cat
|
152 |
* @covers ::question_can_delete_cat
|
| 153 |
* @covers ::question_is_top_category
|
153 |
* @covers ::question_is_top_category
|
| 154 |
*/
|
154 |
*/
|
| 155 |
public function test_question_can_delete_cat_top_category() {
|
155 |
public function test_question_can_delete_cat_top_category(): void {
|
| Línea 156... |
Línea 156... |
| 156 |
|
156 |
|
| Línea 157... |
Línea 157... |
| 157 |
$qcategory1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
157 |
$qcategory1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
| 158 |
|
158 |
|
| Línea 167... |
Línea 167... |
| 167 |
* Test delete only child category in function question_can_delete_cat.
|
167 |
* Test delete only child category in function question_can_delete_cat.
|
| 168 |
*
|
168 |
*
|
| 169 |
* @covers ::question_can_delete_cat
|
169 |
* @covers ::question_can_delete_cat
|
| 170 |
* @covers ::question_is_only_child_of_top_category_in_context
|
170 |
* @covers ::question_is_only_child_of_top_category_in_context
|
| 171 |
*/
|
171 |
*/
|
| 172 |
public function test_question_can_delete_cat_child_category() {
|
172 |
public function test_question_can_delete_cat_child_category(): void {
|
| Línea 173... |
Línea 173... |
| 173 |
|
173 |
|
| Línea 174... |
Línea 174... |
| 174 |
$qcategory1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
174 |
$qcategory1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
| 175 |
|
175 |
|
| Línea 182... |
Línea 182... |
| 182 |
/**
|
182 |
/**
|
| 183 |
* Test delete category in function question_can_delete_cat without capabilities.
|
183 |
* Test delete category in function question_can_delete_cat without capabilities.
|
| 184 |
*
|
184 |
*
|
| 185 |
* @covers ::question_can_delete_cat
|
185 |
* @covers ::question_can_delete_cat
|
| 186 |
*/
|
186 |
*/
|
| 187 |
public function test_question_can_delete_cat_capability() {
|
187 |
public function test_question_can_delete_cat_capability(): void {
|
| Línea 188... |
Línea 188... |
| 188 |
|
188 |
|
| 189 |
$qcategory1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
189 |
$qcategory1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
| Línea 190... |
Línea 190... |
| 190 |
$qcategory2 = $this->qgenerator->create_question_category(['contextid' => $this->context->id, 'parent' => $qcategory1->id]);
|
190 |
$qcategory2 = $this->qgenerator->create_question_category(['contextid' => $this->context->id, 'parent' => $qcategory1->id]);
|
| Línea 205... |
Línea 205... |
| 205 |
* Test question_category_select_menu function.
|
205 |
* Test question_category_select_menu function.
|
| 206 |
*
|
206 |
*
|
| 207 |
* @covers ::question_category_select_menu
|
207 |
* @covers ::question_category_select_menu
|
| 208 |
* @covers ::question_category_options
|
208 |
* @covers ::question_category_options
|
| 209 |
*/
|
209 |
*/
|
| 210 |
public function test_question_category_select_menu() {
|
210 |
public function test_question_category_select_menu(): void {
|
| Línea 211... |
Línea 211... |
| 211 |
|
211 |
|
| 212 |
$this->qgenerator->create_question_category(['contextid' => $this->context->id, 'name' => 'Test this question category']);
|
212 |
$this->qgenerator->create_question_category(['contextid' => $this->context->id, 'name' => 'Test this question category']);
|
| Línea 213... |
Línea 213... |
| 213 |
$contexts = new \core_question\local\bank\question_edit_contexts($this->context);
|
213 |
$contexts = new \core_question\local\bank\question_edit_contexts($this->context);
|
| Línea 228... |
Línea 228... |
| 228 |
* @covers ::get_categories_for_contexts
|
228 |
* @covers ::get_categories_for_contexts
|
| 229 |
* @covers ::question_fix_top_names
|
229 |
* @covers ::question_fix_top_names
|
| 230 |
* @covers ::question_add_context_in_key
|
230 |
* @covers ::question_add_context_in_key
|
| 231 |
* @covers ::add_indented_names
|
231 |
* @covers ::add_indented_names
|
| 232 |
*/
|
232 |
*/
|
| 233 |
public function test_question_category_options() {
|
233 |
public function test_question_category_options(): void {
|
| Línea 234... |
Línea 234... |
| 234 |
|
234 |
|
| 235 |
$qcategory1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
235 |
$qcategory1 = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
| 236 |
$qcategory2 = $this->qgenerator->create_question_category(['contextid' => $this->context->id, 'parent' => $qcategory1->id]);
|
236 |
$qcategory2 = $this->qgenerator->create_question_category(['contextid' => $this->context->id, 'parent' => $qcategory1->id]);
|