Skip to content

Commit da183e5

Browse files
committed
Minor fixes
1 parent d499b85 commit da183e5

File tree

5 files changed

+78
-74
lines changed

5 files changed

+78
-74
lines changed

DependencyInjection/FOSOAuthServerExtension.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,12 @@ protected function loadAuthorize(array $config, ContainerBuilder $container, Xml
148148

149149
$container->setAlias('fos_oauth_server.authorize.form.handler', $config['form']['handler']);
150150
unset($config['form']['handler']);
151-
151+
152152
if (!LegacyFormHelper::isLegacy() && $config['form']['type'] === 'fos_oauth_server_authorize') {
153-
154153
$authorizeFormTypeDefinition = $container->getDefinition('fos_oauth_server.authorize.form.type');
155154
$config['form']['type'] = $authorizeFormTypeDefinition->getClass();
156-
157155
}
158-
156+
159157
$this->remapParametersNamespaces($config, $container, array(
160158
'form' => 'fos_oauth_server.authorize.form.%s',
161159
));

Form/Type/AuthorizeFormType.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class AuthorizeFormType extends AbstractType
2525
public function buildForm(FormBuilderInterface $builder, array $options)
2626
{
2727
$hiddenType = LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\HiddenType');
28-
28+
2929
$builder->add('client_id', $hiddenType);
3030
$builder->add('response_type', $hiddenType);
3131
$builder->add('redirect_uri', $hiddenType);
@@ -60,7 +60,7 @@ public function getBlockPrefix()
6060
{
6161
return 'fos_oauth_server_authorize';
6262
}
63-
63+
6464
/**
6565
* @return string
6666
*/

Tests/Form/Type/AuthorizeFormTypeTest.php

+23-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the FOSOAuthServerBundle package.
5+
*
6+
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace FOS\OAuthServerBundle\Tests\Form\Type;
413

514
use FOS\OAuthServerBundle\Form\Type\AuthorizeFormType;
@@ -14,43 +23,43 @@ class AuthorizeFormTypeTest extends TypeTestCase
1423
protected function setUp()
1524
{
1625
parent::setUp();
17-
26+
1827
$this->factory = Forms::createFormFactoryBuilder()
1928
->addTypes($this->getTypes())
2029
->getFormFactory();
21-
30+
2231
$this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
2332
}
24-
33+
2534
public function testSubmit()
26-
{
35+
{
2736
$accepted = 'true';
2837
$formData = array(
29-
'client_id' => '1',
38+
'client_id' => '1',
3039
'response_type' => 'code',
31-
'redirect_uri'=>'http:\\localhost\test.php',
32-
'state'=>'testState',
33-
'scope'=>'testScope',
40+
'redirect_uri' => 'http:\\localhost\test.php',
41+
'state' => 'testState',
42+
'scope' => 'testScope',
3443
);
35-
44+
3645
$authorize = new Authorize($accepted, $formData);
37-
46+
3847
$form = $this->factory->create(LegacyFormHelper::getType('FOS\OAuthServerBundle\Form\Type\AuthorizeFormType'), $authorize);
39-
48+
4049
$form->submit($formData);
4150

4251
$this->assertTrue($form->isSynchronized());
4352
$this->assertEquals($authorize, $form->getData());
4453
$this->assertEquals((bool) $accepted, $authorize->accepted);
45-
54+
4655
$view = $form->createView();
4756
$children = $view->children;
48-
57+
4958
foreach (array_keys($formData) as $key) {
5059
$this->assertArrayHasKey($key, $children);
5160
}
5261
}
53-
62+
5463
protected function getTypes()
5564
{
5665
return array(

Util/LegacyFormHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class LegacyFormHelper
2020
{
2121
private static $map = array(
2222
'Symfony\Component\Form\Extension\Core\Type\HiddenType' => 'hidden',
23-
'FOS\OAuthServerBundle\Form\Type\AuthorizeFormType'=> 'fos_oauth_server_authorize'
23+
'FOS\OAuthServerBundle\Form\Type\AuthorizeFormType' => 'fos_oauth_server_authorize',
2424
);
2525

2626
public static function getType($class)

composer.json

+50-53
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
11
{
2-
"name" : "friendsofsymfony/oauth-server-bundle",
3-
"type" : "symfony-bundle",
4-
"description" : "Symfony2 OAuth Server Bundle",
5-
"keywords" : [
6-
"oauth",
7-
"oauth2",
8-
"server"
9-
],
10-
"homepage" : "http://friendsofsymfony.github.com",
11-
"license" : "MIT",
12-
"authors" : [{
13-
"name" : "Arnaud Le Blanc",
14-
"email" : "arnaud.lb@gmail.com"
15-
}, {
16-
"name" : "FriendsOfSymfony Community",
17-
"homepage" : "https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/contributors"
18-
}
19-
],
20-
"require" : {
21-
"php" : ">=5.3.3",
22-
"friendsofsymfony/oauth2-php" : "~1.1",
23-
"symfony/framework-bundle" : "~2.2|~3.0",
24-
"symfony/security-bundle" : "~2.1|~3.0"
25-
},
26-
"require-dev" : {
27-
"symfony/class-loader" : "~2.1|~3.0",
28-
"symfony/yaml" : "~2.1|~3.0",
29-
"willdurand/propel-typehintable-behavior" : "^1.0.4",
30-
"propel/propel1" : "^1.6.5",
31-
"phing/phing" : "~2.4",
32-
"doctrine/mongodb-odm" : "~1.0",
33-
"doctrine/doctrine-bundle" : "~1.0",
34-
"doctrine/orm" : "~2.2",
35-
"symfony/form" : "~2.3|~3.0"
36-
},
37-
"suggest" : {
38-
"doctrine/doctrine-bundle" : "*",
39-
"doctrine/mongodb-odm-bundle" : "*",
40-
"propel/propel-bundle" : "If you want to use Propel with Symfony2, then you will have to install the PropelBundle",
41-
"willdurand/propel-typehintable-behavior" : "The Typehintable behavior is useful to add type hints on generated methods, to be compliant with interfaces",
42-
"symfony/form" : "If you want to use the Authorize form, then you will have to install the Symfony Form Component"
43-
},
44-
"autoload" : {
45-
"psr-4" : {
46-
"FOS\\OAuthServerBundle\\" : ""
47-
}
48-
},
49-
"extra" : {
50-
"branch-alias" : {
51-
"dev-master" : "1.5-dev"
52-
}
53-
}
54-
}
2+
"name": "friendsofsymfony/oauth-server-bundle",
3+
"type": "symfony-bundle",
4+
"description": "Symfony2 OAuth Server Bundle",
5+
"keywords": ["oauth", "oauth2", "server"],
6+
"homepage": "http://friendsofsymfony.github.com",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "Arnaud Le Blanc",
11+
"email": "arnaud.lb@gmail.com"
12+
},
13+
{
14+
"name": "FriendsOfSymfony Community",
15+
"homepage": "https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/contributors"
16+
}
17+
],
18+
"require": {
19+
"php": "^5.3.3|^7.0",
20+
"friendsofsymfony/oauth2-php": "~1.1",
21+
"symfony/framework-bundle": "~2.2|~3.0",
22+
"symfony/security-bundle": "~2.1|~3.0"
23+
},
24+
"require-dev": {
25+
"symfony/class-loader": "~2.1|~3.0",
26+
"symfony/yaml": "~2.1|~3.0",
27+
"symfony/form": "~2.1|~3.0",
28+
"willdurand/propel-typehintable-behavior": "^1.0.4",
29+
"propel/propel1": "^1.6.5",
30+
"phing/phing": "~2.4",
31+
"doctrine/mongodb-odm": "~1.0",
32+
"doctrine/doctrine-bundle": "~1.0",
33+
"doctrine/orm": "~2.2"
34+
},
35+
"suggest": {
36+
"doctrine/doctrine-bundle": "*",
37+
"doctrine/mongodb-odm-bundle": "*",
38+
"propel/propel-bundle": "If you want to use Propel with Symfony2, then you will have to install the PropelBundle",
39+
"willdurand/propel-typehintable-behavior": "The Typehintable behavior is useful to add type hints on generated methods, to be compliant with interfaces",
40+
"symfony/form" : "Needed to be able to use the AuthorizeFormType"
41+
},
42+
"autoload": {
43+
"psr-4": { "FOS\\OAuthServerBundle\\": "" }
44+
},
45+
"extra": {
46+
"branch-alias": {
47+
"dev-master": "1.5-dev"
48+
}
49+
}
50+
51+
}

0 commit comments

Comments
 (0)