Example #1
0
 /**
  * {@inheritdoc}
  */
 public function render($data, array $options)
 {
     $action = $options['action'];
     return $this->formFactory->create(CsrfProtectionType::class, null, ['method' => strtoupper($options['method']), 'action' => parent::render($data, $options), 'label' => $action->getLabel(), 'translation_domain' => $action->getOption('trans_domain')])->createView();
 }
Example #2
0
 public function testRender()
 {
     $this->urlGenerator->expects($this->once())->method('generate')->with($this->identicalTo($route = 'route_value'), $this->identicalTo([$routeParameter = 'route_parameter' => $routeParameterValue = 'route_parameter_value']), $this->identicalTo($routeReferenceType = UrlGeneratorInterface::ABSOLUTE_PATH))->will($this->returnValue($url = 'url_value'));
     $this->propertyAccessor->expects($this->once())->method('getValue')->with($this->identicalTo($data = new \stdClass()), $this->identicalTo($routeParameter))->will($this->returnValue($routeParameterValue));
     $this->assertSame($url, $this->type->render($data, ['route' => $route, 'route_parameters' => [$routeParameter], 'route_reference_type' => $routeReferenceType]));
 }