-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
4.0
-
MOODLE_400_STABLE
Spotted in MDL-73645, the test 'theme/boost/tests/boostnavbar_test.php' currently tests the internals of the class and no public methods, which isn't considered best practice.
In addition to the above, it makes assertions about the protected method 'remove_items_that_exist_in_navigation' which are at odds with how the class behaves at a public level. A scenario verifies that nodes duplicated in the primary navigation are removed when calling remove_items_that_exist_in_navigation() with an instance of core\navigation\views\primary. However, boostnavbar never calls the protected method with an instance of primary (it always passes secondary) and so the real usage of the class won't remove nodes present in the primary nav.
The navigation code appears to rely on some uses of magic getters and global $PAGE, but I think we should still be able to improve on what we've got here simply by testing the behavior of the objects, rather than testing specific internals. boostnavbar->get_items() seems like a good candidate to start with.
- Discovered while testing
-
MDL-73645 Re-implement breadcrumbs in the course pages
-
- Closed
-