/** * Boots the Bundle. */ public function boot() { if ($this->container->has('error_handler')) { $this->container->get('error_handler'); } if ($this->container->hasParameter('csrf_secret')) { FormConfiguration::setDefaultCsrfSecret($this->container->getParameter('csrf_secret')); FormConfiguration::enableDefaultCsrfProtection(); } }
public function testDefaultCsrfSecretCanBeSet() { FormConfiguration::setDefaultCsrfSecret('foobar'); $form = new Form('author', new Author(), $this->validator); $form->enableCsrfProtection(); $this->assertEquals('foobar', $form->getCsrfSecret()); }