Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 29... Línea 29...
29
 * @package     core
29
 * @package     core
30
 * @category    navigation
30
 * @category    navigation
31
 * @copyright   2021 onwards Peter Dias
31
 * @copyright   2021 onwards Peter Dias
32
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33
 */
33
 */
34
class secondary_test extends \advanced_testcase {
34
final class secondary_test extends \advanced_testcase {
35
    /**
35
    /**
36
     * Test the get_leaf_nodes function
36
     * Test the get_leaf_nodes function
37
     * @param float $siteorder The order for the siteadmin node
37
     * @param float $siteorder The order for the siteadmin node
38
     * @param float $courseorder The order for the course node
38
     * @param float $courseorder The order for the course node
39
     * @param float $moduleorder The order for the module node
39
     * @param float $moduleorder The order for the module node
Línea 71... Línea 71...
71
 
71
 
72
    /**
72
    /**
73
     * Data provider for test_get_leaf_nodes
73
     * Data provider for test_get_leaf_nodes
74
     * @return array
74
     * @return array
75
     */
75
     */
76
    public function leaf_nodes_order_provider(): array {
76
    public static function leaf_nodes_order_provider(): array {
77
        return [
77
        return [
78
            'Initialise the order with whole numbers' => [3, 2, 1],
78
            'Initialise the order with whole numbers' => [3, 2, 1],
79
            'Initialise the order with a mix of whole and float numbers' => [2.1, 2, 1],
79
            'Initialise the order with a mix of whole and float numbers' => [2.1, 2, 1],
80
        ];
80
        ];
Línea 137... Línea 137...
137
 
137
 
138
    /**
138
    /**
139
     * Data provider for the test_setting_initialise function
139
     * Data provider for the test_setting_initialise function
140
     * @return array
140
     * @return array
141
     */
141
     */
142
    public function setting_initialise_provider(): array {
142
    public static function setting_initialise_provider(): array {
143
        return [
143
        return [
144
            'Testing in a course context' => ['course', 'coursehome', 'courseheader', 'Course'],
144
            'Testing in a course context' => ['course', 'coursehome', 'courseheader', 'Course'],
145
            'Testing in a course context using a single activity course format' =>
145
            'Testing in a course context using a single activity course format' =>
146
                ['course', 'course', 'courseheader', 'Course', 'singleactivity'],
146
                ['course', 'course', 'courseheader', 'Course', 'singleactivity'],
Línea 229... Línea 229...
229
    /**
229
    /**
230
     * Data provider for the active_node_scan_provider
230
     * Data provider for the active_node_scan_provider
231
     *
231
     *
232
     * @return array
232
     * @return array
233
     */
233
     */
234
    public function active_node_scan_provider(): array {
234
    public static function active_node_scan_provider(): array {
235
        return [
235
        return [
236
            'Test by activating node adjacent to root node'
236
            'Test by activating node adjacent to root node'
237
                => ['firstchild', 'firstchild'],
237
                => ['firstchild', 'firstchild'],
238
            'Activate a grand child node of the root'
238
            'Activate a grand child node of the root'
239
                => ['thirdchild', 'tenthchild'],
239
                => ['thirdchild', 'tenthchild'],
Línea 287... Línea 287...
287
    /**
287
    /**
288
     * Data provider for the test_force_nodes_into_more_menu function.
288
     * Data provider for the test_force_nodes_into_more_menu function.
289
     *
289
     *
290
     * @return array
290
     * @return array
291
     */
291
     */
292
    public function force_nodes_into_more_menu_provider(): array {
292
    public static function force_nodes_into_more_menu_provider(): array {
293
        return [
293
        return [
294
            'The total number of navigation nodes exceeds the max display limit (5); ' .
294
            'The total number of navigation nodes exceeds the max display limit (5); ' .
295
            'navnode2 and navnode4 are forced into "more" menu by default.' =>
295
            'navnode2 and navnode4 are forced into "more" menu by default.' =>
296
                [
296
                [
297
                    [
297
                    [
Línea 470... Línea 470...
470
    /**
470
    /**
471
     * Provider for test_nodes_match_current_url
471
     * Provider for test_nodes_match_current_url
472
     *
472
     *
473
     * @return \string[][]
473
     * @return \string[][]
474
     */
474
     */
475
    public function nodes_match_current_url_provider(): array {
475
    public static function nodes_match_current_url_provider(): array {
476
        return [
476
        return [
477
            "Match url to a node that is a deep nested" => [
477
            "Match url to a node that is a deep nested" => [
478
                '/view/course.php',
478
                '/view/course.php',
479
                'child2.1',
479
                'child2.1',
480
            ],
480
            ],
Línea 528... Línea 528...
528
    /**
528
    /**
529
     * Provider for test_get_menu_array
529
     * Provider for test_get_menu_array
530
     *
530
     *
531
     * @return array[]
531
     * @return array[]
532
     */
532
     */
533
    public function get_menu_array_provider(): array {
533
    public static function get_menu_array_provider(): array {
534
        return [
534
        return [
535
            "Fetch information from a node with action and no children" => [
535
            "Fetch information from a node with action and no children" => [
536
                'child1',
536
                'child1',
537
                [
537
                [
538
                    'https://www.example.com/moodle/my' => 'child1'
538
                    'https://www.example.com/moodle/my' => 'child1'
Línea 633... Línea 633...
633
    /**
633
    /**
634
     * Provider for test_get_node_with_first_action
634
     * Provider for test_get_node_with_first_action
635
     *
635
     *
636
     * @return array
636
     * @return array
637
     */
637
     */
638
    public function get_node_with_first_action_provider(): array {
638
    public static function get_node_with_first_action_provider(): array {
639
        return [
639
        return [
640
            "Search for action when parent has no action and multiple children with actions" => [
640
            "Search for action when parent has no action and multiple children with actions" => [
641
                "child3",
641
                "child3",
642
                "child3.1",
642
                "child3.1",
643
            ],
643
            ],
Línea 692... Línea 692...
692
    /**
692
    /**
693
     * Provider for the add_external_nodes_to_secondary function.
693
     * Provider for the add_external_nodes_to_secondary function.
694
     *
694
     *
695
     * @return array
695
     * @return array
696
     */
696
     */
697
    public function add_external_nodes_to_secondary_provider() {
697
    public static function add_external_nodes_to_secondary_provider(): array {
698
        return [
698
        return [
699
            "Container node with internal action and external children" => [
699
            "Container node with internal action and external children" => [
700
                [
700
                [
701
                    'parentnode1' => [
701
                    'parentnode1' => [
702
                        'action' => '/test.php',
702
                        'action' => '/test.php',
Línea 860... Línea 860...
860
    /**
860
    /**
861
     * Data provider for test_get_overflow_menu_data
861
     * Data provider for test_get_overflow_menu_data
862
     *
862
     *
863
     * @return string[]
863
     * @return string[]
864
     */
864
     */
865
    public function get_overflow_menu_data_provider(): array {
865
    public static function get_overflow_menu_data_provider(): array {
866
        return [
866
        return [
867
            "Active node is the course home node" => [
867
            "Active node is the course home node" => [
868
                '/coursehome.php',
868
                '/coursehome.php',
869
                true
869
                true
870
            ],
870
            ],
Línea 925... Línea 925...
925
    /**
925
    /**
926
     * Data provider for the other half of the method thing
926
     * Data provider for the other half of the method thing
927
     *
927
     *
928
     * @return array Provider information.
928
     * @return array Provider information.
929
     */
929
     */
930
    public function get_overflow_menu_data_course_admin_provider(): array {
930
    public static function get_overflow_menu_data_course_admin_provider(): array {
931
        return [
931
        return [
932
            "Backup page returns overflow" => [
932
            "Backup page returns overflow" => [
933
                '/backup/backup.php',
933
                '/backup/backup.php',
934
                'id',
934
                'id',
935
                false,
935
                false,
Línea 960... Línea 960...
960
                'id',
960
                'id',
961
                false
961
                false
962
            ],
962
            ],
963
            "Question bank should return nothing" => [
963
            "Question bank should return nothing" => [
964
                '/question/edit.php',
964
                '/question/edit.php',
965
                'courseid',
965
                'cmid',
966
                false
966
                false
967
            ],
967
            ],
968
            "Reports should return nothing" => [
968
            "Reports should return nothing" => [
969
                '/report/log/index.php',
969
                '/report/log/index.php',
970
                'id',
970
                'id',