function RouteProcessorCsrfTest::testProcessOutboundNoRequirement

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php \Drupal\Tests\Core\Access\RouteProcessorCsrfTest::testProcessOutboundNoRequirement()
  2. 10 core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php \Drupal\Tests\Core\Access\RouteProcessorCsrfTest::testProcessOutboundNoRequirement()
  3. 11.x 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 45

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);
}

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