You are here

public function RouteProcessorCsrfTest::testProcessOutboundNoRequirement in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php \Drupal\Tests\Core\Access\RouteProcessorCsrfTest::testProcessOutboundNoRequirement()

Tests the processOutbound() method with no _csrf_token route requirement.

File

core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php, line 42

Class

RouteProcessorCsrfTest
@coversDefaultClass \Drupal\Core\Access\RouteProcessorCsrf @group Access

Namespace

Drupal\Tests\Core\Access

Code

public function testProcessOutboundNoRequirement() {
  $this->csrfToken
    ->expects($this
    ->never())
    ->method('get');
  $route = new Route('/test-path');
  $parameters = [];
  $bubbleable_metadata = new BubbleableMetadata();
  $this->processor
    ->processOutbound('test', $route, $parameters, $bubbleable_metadata);

  // No parameters should be added to the parameters array.
  $this
    ->assertEmpty($parameters);

  // Cacheability of routes without a _csrf_token route requirement is
  // unaffected.
  $this
    ->assertEquals(new BubbleableMetadata(), $bubbleable_metadata);
}