/**
  * Tests the processOutbound() method with two parameter replacements.
  */
 public function testProcessOutboundDynamicTwo()
 {
     $this->csrfToken->expects($this->once())->method('get')->with('100/test-path/test')->will($this->returnValue('test_token'));
     $route = new Route('{slug_1}/test-path/{slug_2}', array(), array('_csrf_token' => 'TRUE'));
     $parameters = array('slug_1' => 100, 'slug_2' => 'test');
     $this->assertNull($this->processor->processOutbound('test', $route, $parameters));
 }
Exemplo n.º 2
0
 /**
  * Tests the processOutbound() method with two parameter replacements.
  */
 public function testProcessOutboundDynamicTwo()
 {
     $this->csrfToken->expects($this->once())->method('get')->with('100/test-path/test')->will($this->returnValue('test_token'));
     $route = new Route('{slug_1}/test-path/{slug_2}', array(), array('_csrf_token' => 'TRUE'));
     $parameters = array('slug_1' => 100, 'slug_2' => 'test');
     $cacheable_metadata = new CacheableMetadata();
     $this->processor->processOutbound('test', $route, $parameters, $cacheable_metadata);
     // Cacheability of routes with a _csrf_token route requirement is max-age=0.
     $this->assertEquals((new CacheableMetadata())->setCacheMaxAge(0), $cacheable_metadata);
 }
Exemplo n.º 3
0
 /**
  * Tests the processOutbound() method with two parameter replacements.
  */
 public function testProcessOutboundDynamicTwo()
 {
     $route = new Route('{slug_1}/test-path/{slug_2}', array(), array('_csrf_token' => 'TRUE'));
     $parameters = array('slug_1' => 100, 'slug_2' => 'test');
     $bubbleable_metadata = new BubbleableMetadata();
     $this->processor->processOutbound('test', $route, $parameters, $bubbleable_metadata);
     // Bubbleable metadata of routes with a _csrf_token route requirement is a
     // placeholder.
     $path = '100/test-path/test';
     $placeholder = hash('sha1', $path);
     $placeholder_render_array = ['#lazy_builder' => ['route_processor_csrf:renderPlaceholderCsrfToken', [$path]]];
     $this->assertEquals((new BubbleableMetadata())->setAttachments(['placeholders' => [$placeholder => $placeholder_render_array]]), $bubbleable_metadata);
 }