You are here

public function RouteProcessorCsrfTest::testProcessOutboundNoRequirement in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 46
Contains \Drupal\Tests\Core\Access\RouteProcessorCsrfTest.

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 = array();
  $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);
}