Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 37... Línea 37...
37
 * @package   core
37
 * @package   core
38
 * @category  test
38
 * @category  test
39
 * @copyright 2009 Sam Hemelryk
39
 * @copyright 2009 Sam Hemelryk
40
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (5)
40
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (5)
41
 */
41
 */
42
class navigationlib_test extends \advanced_testcase {
42
final class navigationlib_test extends \advanced_testcase {
43
    /**
43
    /**
44
     * @var navigation_node
44
     * @var navigation_node
45
     */
45
     */
46
    public $node;
46
    public $node;
Línea 47... Línea 47...
47
 
47
 
48
    protected function setup_node() {
48
    protected function setup_node() {
Línea -... Línea 49...
-
 
49
        global $PAGE, $SITE;
-
 
50
 
-
 
51
        // Perform a reset between tests to reset the PAGE.
49
        global $PAGE, $SITE;
52
        $this->resetAfterTest();
50
 
53
 
Línea 51... Línea 54...
51
        $PAGE->set_url('/');
54
        $PAGE->set_url('/');
52
        $PAGE->set_course($SITE);
55
        $PAGE->set_course($SITE);
Línea 602... Línea 605...
602
    /**
605
    /**
603
     * Data provider for the test_set_force_into_more_menu function.
606
     * Data provider for the test_set_force_into_more_menu function.
604
     *
607
     *
605
     * @return array
608
     * @return array
606
     */
609
     */
607
    public function set_force_into_more_menu_provider(): array {
610
    public static function set_force_into_more_menu_provider(): array {
608
        return [
611
        return [
609
            'Navigation node without any children nodes; Force into "more" menu => true.' =>
612
            'Navigation node without any children nodes; Force into "more" menu => true.' =>
610
                [
613
                [
611
                    false,
614
                    false,
612
                    true,
615
                    true,
Línea 639... Línea 642...
639
    /**
642
    /**
640
     * Data provider for the test_is_action_link function.
643
     * Data provider for the test_is_action_link function.
641
     *
644
     *
642
     * @return array
645
     * @return array
643
     */
646
     */
644
    public function is_action_link_provider(): array {
647
    public static function is_action_link_provider(): array {
645
        return [
648
        return [
646
            'The navigation node has an action link.' =>
649
            'The navigation node has an action link.' =>
647
                [
650
                [
648
                    navigation_node::create('Node', new action_link(new \moodle_url('/'), '',
651
                    navigation_node::create('Node', new action_link(new \moodle_url('/'), '',
649
                        new popup_action('click', new \moodle_url('/'))), navigation_node::TYPE_SETTING),
652
                        new popup_action('click', new \moodle_url('/'))), navigation_node::TYPE_SETTING),
Línea 692... Línea 695...
692
    /**
695
    /**
693
     * Data provider for the test_action_link_actions function.
696
     * Data provider for the test_action_link_actions function.
694
     *
697
     *
695
     * @return array
698
     * @return array
696
     */
699
     */
697
    public function action_link_actions_provider(): array {
700
    public static function action_link_actions_provider(): array {
698
        return [
701
        return [
699
            'The navigation node has an action link with an action attached.' =>
702
            'The navigation node has an action link with an action attached.' =>
700
                [
703
                [
701
                    navigation_node::create('Node', new action_link(new \moodle_url('/'), '',
704
                    navigation_node::create('Node', new action_link(new \moodle_url('/'), '',
702
                        new popup_action('click', new \moodle_url('/'))), navigation_node::TYPE_SETTING),
705
                        new popup_action('click', new \moodle_url('/'))), navigation_node::TYPE_SETTING),
Línea 719... Línea 722...
719
 * This is a dummy object that allows us to call protected methods within the
722
 * This is a dummy object that allows us to call protected methods within the
720
 * global navigation class by prefixing the methods with `exposed_`
723
 * global navigation class by prefixing the methods with `exposed_`
721
 */
724
 */
722
class exposed_global_navigation extends global_navigation {
725
class exposed_global_navigation extends global_navigation {
723
    protected $exposedkey = 'exposed_';
726
    protected $exposedkey = 'exposed_';
724
    public function __construct(\moodle_page $page=null) {
727
    public function __construct(?\moodle_page $page=null) {
725
        global $PAGE;
728
        global $PAGE;
726
        if ($page === null) {
729
        if ($page === null) {
727
            $page = $PAGE;
730
            $page = $PAGE;
728
        }
731
        }
729
        parent::__construct($page);
732
        parent::__construct($page);