| Línea 24... |
Línea 24... |
| 24 |
* @package core
|
24 |
* @package core
|
| 25 |
* @copyright Petr Skoda
|
25 |
* @copyright Petr Skoda
|
| 26 |
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
26 |
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 27 |
* @coversDefaultClass \core\context_helper
|
27 |
* @coversDefaultClass \core\context_helper
|
| 28 |
*/
|
28 |
*/
|
| 29 |
class context_helper_test extends \advanced_testcase {
|
29 |
final class context_helper_test extends \advanced_testcase {
|
| 30 |
/**
|
30 |
/**
|
| 31 |
* Tests covered method.
|
31 |
* Tests covered method.
|
| 32 |
* @covers ::parse_external_level
|
32 |
* @covers ::parse_external_level
|
| 33 |
*/
|
33 |
*/
|
| 34 |
public function test_parse_external_level(): void {
|
34 |
public function test_parse_external_level(): void {
|
| Línea 279... |
Línea 279... |
| 279 |
if ($classname::LEVEL == CONTEXT_SYSTEM) {
|
279 |
if ($classname::LEVEL == CONTEXT_SYSTEM) {
|
| 280 |
continue;
|
280 |
continue;
|
| 281 |
}
|
281 |
}
|
| 282 |
$record = new \stdClass();
|
282 |
$record = new \stdClass();
|
| 283 |
$record->contextlevel = $classname::LEVEL;
|
283 |
$record->contextlevel = $classname::LEVEL;
|
| 284 |
$record->instanceid = 9999999999;
|
284 |
$record->instanceid = SQL_INT_MAX;
|
| 285 |
$record->path = null;
|
285 |
$record->path = null;
|
| 286 |
$record->depth = '2';
|
286 |
$record->depth = '2';
|
| 287 |
$record->id = $DB->insert_record('context', $record);
|
287 |
$record->id = $DB->insert_record('context', $record);
|
| 288 |
$DB->set_field('context', 'path', SYSCONTEXTID . '/' . $record->id, ['id' => $record->id]);
|
288 |
$DB->set_field('context', 'path', SYSCONTEXTID . '/' . $record->id, ['id' => $record->id]);
|
| 289 |
}
|
289 |
}
|
| Línea 481... |
Línea 481... |
| 481 |
$coursecontext = context\course::instance($course->id);
|
481 |
$coursecontext = context\course::instance($course->id);
|
| 482 |
$page = $this->getDataGenerator()->create_module('page', array('course' => $course->id));
|
482 |
$page = $this->getDataGenerator()->create_module('page', array('course' => $course->id));
|
| 483 |
$pagecontext = context\module::instance($page->cmid);
|
483 |
$pagecontext = context\module::instance($page->cmid);
|
| 484 |
$systemcontext = context\system::instance();
|
484 |
$systemcontext = context\system::instance();
|
| Línea 485... |
Línea -... |
| 485 |
|
- |
|
| 486 |
// Default is OFF.
|
- |
|
| 487 |
$this->assertSame('0', $CFG->filternavigationwithsystemcontext);
|
- |
|
| 488 |
|
485 |
|
| 489 |
// First test passed values are returned if disabled.
|
486 |
// First test passed values are returned if disabled.
|
| Línea 490... |
Línea 487... |
| 490 |
set_config('filternavigationwithsystemcontext', '0');
|
487 |
set_config('filternavigationwithsystemcontext', '0');
|