function MenuLegacyTest::testMenuCacheClearAll

Tests deprecation of the menu_cache_clear_all() function.

@expectedDeprecation menu_cache_clear_all() is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Use \Drupal::cache('menu')->invalidateAll() instead. See https://www.drupal.org/node/2989138

File

core/tests/Drupal/KernelTests/Core/Menu/MenuLegacyTest.php, line 46

Class

MenuLegacyTest
Deprecation tests cases for the menu layer.

Namespace

Drupal\KernelTests\Core\Menu

Code

public function testMenuCacheClearAll() {
    $cache = \Drupal::cache('menu');
    $cache->set('test_cache', 'test_data');
    menu_cache_clear_all();
    $this->assertFalse($cache->get('test_cache'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.