function BookTest::testBookNavigationCacheContextDeprecatedParameter

Test the book navigation cache context argument deprecation.

@group legacy

File

core/modules/book/tests/src/Functional/BookTest.php, line 105

Class

BookTest
Create a book, add pages, and test book interface.

Namespace

Drupal\Tests\book\Functional

Code

public function testBookNavigationCacheContextDeprecatedParameter() {
    $this->expectDeprecation('Passing the request_stack service to Drupal\\book\\Cache\\BookNavigationCacheContext::__construct() is deprecated in drupal:9.2.0 and will be removed before drupal:10.0.0. The parameter should be an instance of \\Drupal\\Core\\Routing\\RouteMatchInterface instead.');
    $request_stack = $this->container
        ->get('request_stack');
    $book_navigation_cache_context = new BookNavigationCacheContext($request_stack);
    $this->assertNotNull($book_navigation_cache_context);
}

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