MDL-86452 core: Reset navigation data between tests

This commit is contained in:
Andrew Nicols
2025-08-28 13:13:05 +08:00
parent d63b359944
commit 9b060f43ce
4 changed files with 39 additions and 0 deletions
+21
View File
@@ -145,6 +145,27 @@ STRING;
self::assertTag(['id' => 'testid'], "<div><div>");
}
/**
* Test that the navigation node URL is overridden correctly.
*/
public function test_set_navigation_url(): void {
\navigation_node::override_active_url(new \moodle_url('/foo/bar/baz'));
$this->assertNotNull(
(new \ReflectionClass(\navigation_node::class))->getStaticPropertyValue('fullmeurl', null)
);
}
/**
* Test that the after-test teardown correctly resets the navigation node URL.
*
* @depends test_set_navigation_url
*/
public function test_navigation_url_reset(): void {
$this->assertNull(
(new \ReflectionClass(\navigation_node::class))->getStaticPropertyValue('fullmeurl', null)
);
}
// Uncomment following tests to see logging of unexpected changes in global state and database.
/*
public function test_db_modification() {