public function buildForm(FormBuilderInterface $builder, array $options) { $hiddenType = LegacyFormHelper::getType('Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType'); $builder->add('client_id', $hiddenType); $builder->add('response_type', $hiddenType); $builder->add('redirect_uri', $hiddenType); $builder->add('state', $hiddenType); $builder->add('scope', $hiddenType); }
public function testSubmit() { $accepted = 'true'; $formData = array('client_id' => '1', 'response_type' => 'code', 'redirect_uri' => 'http:\\localhost\\test.php', 'state' => 'testState', 'scope' => 'testScope'); $authorize = new Authorize($accepted, $formData); $form = $this->factory->create(LegacyFormHelper::getType('FOS\\OAuthServerBundle\\Form\\Type\\AuthorizeFormType'), $authorize); $form->submit($formData); $this->assertTrue($form->isSynchronized()); $this->assertEquals($authorize, $form->getData()); $this->assertEquals((bool) $accepted, $authorize->accepted); $view = $form->createView(); $children = $view->children; foreach (array_keys($formData) as $key) { $this->assertArrayHasKey($key, $children); } }
protected function loadAuthorize(array $config, ContainerBuilder $container, XmlFileLoader $loader) { $loader->load('authorize.xml'); $container->setAlias('fos_oauth_server.authorize.form.handler', $config['form']['handler']); unset($config['form']['handler']); if (!LegacyFormHelper::isLegacy() && $config['form']['type'] === 'fos_oauth_server_authorize') { $authorizeFormTypeDefinition = $container->getDefinition('fos_oauth_server.authorize.form.type'); $config['form']['type'] = $authorizeFormTypeDefinition->getClass(); } $this->remapParametersNamespaces($config, $container, array('form' => 'fos_oauth_server.authorize.form.%s')); }