mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
Merge branch 'MDL-75077' of https://github.com/paulholden/moodle
This commit is contained in:
commit
3c49d97f1c
@ -3657,6 +3657,7 @@ class custom_menu_item implements renderable, templatable {
|
||||
$syscontext = context_system::instance();
|
||||
|
||||
$context = new stdClass();
|
||||
$context->moremenuid = uniqid();
|
||||
$context->text = external_format_string($this->text, $syscontext->id);
|
||||
$context->url = $this->url ? $this->url->out() : null;
|
||||
// No need for the title if it's the same with text.
|
||||
|
@ -159,7 +159,20 @@ class primary_test extends \advanced_testcase {
|
||||
$method = new ReflectionMethod('core\navigation\output\primary', 'get_custom_menu');
|
||||
$method->setAccessible(true);
|
||||
$renderer = $PAGE->get_renderer('core');
|
||||
$this->assertEquals($expected, $method->invoke($output, $renderer));
|
||||
|
||||
// We can't assert the value of each menuitem "moremenuid" property (because it's random).
|
||||
$custommenufilter = static function(array $custommenu) use (&$custommenufilter): void {
|
||||
foreach ($custommenu as $menuitem) {
|
||||
unset($menuitem->moremenuid);
|
||||
// Recursively move through child items.
|
||||
$custommenufilter($menuitem->children);
|
||||
}
|
||||
};
|
||||
|
||||
$actual = $method->invoke($output, $renderer);
|
||||
$custommenufilter($actual);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user