diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php index a550048..3230601 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php @@ -225,7 +225,7 @@ function testThemeCallbackNoThemeRequested() { function testHookCustomTheme() { // Trigger hook_custom_theme() to dynamically request the Stark theme for // the requested page. - variable_set('menu_test_hook_custom_theme_name', 'stark'); + state()->set('menu_test.hook_custom_theme_name', 'stark'); theme_enable(array('stark', 'seven')); // Visit a page that does not implement a theme callback. The above request @@ -241,7 +241,7 @@ function testHookCustomTheme() { function testThemeCallbackHookCustomTheme() { // Trigger hook_custom_theme() to dynamically request the Stark theme for // the requested page. - variable_set('menu_test_hook_custom_theme_name', 'stark'); + state()->set('menu_test.hook_custom_theme_name', 'stark'); theme_enable(array('stark', 'seven')); // The menu "theme callback" should take precedence over a value set in diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php index 21ae3f9..0de2499 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php @@ -88,12 +88,12 @@ function testMenuTreeSetPath() { ); // Test the tree generation for the Tools menu. - variable_del('menu_test_menu_tree_set_path'); + state()->delete('menu_test.menu_tree_set_path'); $this->assertBreadcrumb('menu-test/menu-trail', $breadcrumb, t('Menu trail - Case 1'), $tree); // Override the active trail for the Administration tree; it should not // affect the Tools tree. - variable_set('menu_test_menu_tree_set_path', $test_menu_path); + state()->set('menu_test.menu_tree_set_path', $test_menu_path); $this->assertBreadcrumb('menu-test/menu-trail', $breadcrumb, t('Menu trail - Case 1'), $tree); $breadcrumb = $config + array( @@ -114,12 +114,12 @@ function testMenuTreeSetPath() { ); // Test the tree generation for the Administration menu. - variable_del('menu_test_menu_tree_set_path'); + state()->delete('menu_test.menu_tree_set_path'); $this->assertBreadcrumb('admin/config/development/menu-trail', $breadcrumb, t('Menu trail - Case 2'), $tree); // Override the active trail for the Administration tree; it should affect // the breadcrumbs and Administration tree. - variable_set('menu_test_menu_tree_set_path', $test_menu_path); + state()->set('menu_test.menu_tree_set_path', $test_menu_path); $this->assertBreadcrumb('admin/config/development/menu-trail', $override_breadcrumb, t('Menu trail - Case 2'), $override_tree); } @@ -171,13 +171,13 @@ function testCustom403And404Pages() { foreach (array(403, 404) as $status_code) { // Before visiting the page, trigger the code in the menu_test module // that will record the active trail (so we can check it in this test). - variable_set('menu_test_record_active_trail', TRUE); + state()->set('menu_test.record_active_trail', TRUE); $this->drupalGet($paths[$status_code]); $this->assertResponse($status_code); // Check that the initial trail (during the Drupal bootstrap) matches // what we expect. - $initial_trail = variable_get('menu_test_active_trail_initial', array()); + $initial_trail = state()->get('menu_test.active_trail_initial'); $this->assertEqual(count($initial_trail), count($expected_trail[$status_code]['initial']), format_string('The initial active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array( '@status_code' => $status_code, '@expected' => count($expected_trail[$status_code]['initial']), @@ -194,7 +194,7 @@ function testCustom403And404Pages() { // Check that the final trail (after the user has been redirected to the // custom 403/404 page) matches what we expect. - $final_trail = variable_get('menu_test_active_trail_final', array()); + $final_trail = state()->get('menu_test.active_trail_final'); $this->assertEqual(count($final_trail), count($expected_trail[$status_code]['final']), format_string('The final active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array( '@status_code' => $status_code, '@expected' => count($expected_trail[$status_code]['final']), diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index 5b5063d..205cacc 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -394,7 +394,7 @@ function menu_test_callback() { * Callback that test menu_test_menu_tree_set_path(). */ function menu_test_menu_trail_callback() { - $menu_path = variable_get('menu_test_menu_tree_set_path', array()); + $menu_path = state()->get('menu_test.menu_tree_set_path'); if (!empty($menu_path)) { menu_tree_set_path($menu_path['menu_name'], $menu_path['path']); } @@ -408,8 +408,8 @@ function menu_test_init() { // When requested by one of the MenuTrailTestCase tests, record the initial // active trail during Drupal's bootstrap (before the user is redirected to a // custom 403 or 404 page). See menu_test_custom_403_404_callback(). - if (variable_get('menu_test_record_active_trail', FALSE)) { - variable_set('menu_test_active_trail_initial', menu_get_active_trail()); + if (state()->get('menu_test.record_active_trail')) { + state()->set('menu_test.active_trail_initial', menu_get_active_trail()); } } @@ -420,8 +420,8 @@ function menu_test_custom_403_404_callback() { // When requested by one of the MenuTrailTestCase tests, record the final // active trail now that the user has been redirected to the custom 403 or // 404 page. See menu_test_init(). - if (variable_get('menu_test_record_active_trail', FALSE)) { - variable_set('menu_test_active_trail_final', menu_get_active_trail()); + if (state()->get('menu_test.record_active_trail')) { + state()->set('menu_test.active_trail_final', menu_get_active_trail()); } return 'This is menu_test_custom_403_404_callback().'; @@ -487,7 +487,7 @@ function menu_test_custom_theme() { // If an appropriate variable has been set in the database, request the theme // that is stored there. Otherwise, do not attempt to dynamically set the // theme. - if ($theme = variable_get('menu_test_hook_custom_theme_name', FALSE)) { + if ($theme = state()->get('menu_test.hook_custom_theme_name')) { return $theme; } }