Skip to content

Commit f90e2c0

Browse files
committed
Fix deprecated routing configuration
1 parent 0cb7971 commit f90e2c0

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

Resources/config/routing/authorize.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
66

7-
<route id="fos_oauth_server_authorize" pattern="/oauth/v2/auth">
7+
<route id="fos_oauth_server_authorize" path="/oauth/v2/auth" methods="GET POST">
88
<default key="_controller">FOSOAuthServerBundle:Authorize:authorize</default>
9-
<requirement key="_method">GET|POST</requirement>
109
</route>
1110

1211
</routes>

Resources/config/routing/token.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
66

7-
<route id="fos_oauth_server_token" pattern="/oauth/v2/token">
7+
<route id="fos_oauth_server_token" path="/oauth/v2/token" methods="GET POST">
88
<default key="_controller">fos_oauth_server.controller.token:tokenAction</default>
9-
<requirement key="_method">GET|POST</requirement>
109
</route>
1110

1211
</routes>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace DependencyInjection;
4+
5+
use Symfony\Component\Config\FileLocator;
6+
use Symfony\Component\Routing\Loader\XmlFileLoader;
7+
8+
class FOSOAuthServerExtensionTest extends \PHPUnit_Framework_TestCase
9+
{
10+
public function testLoadAuthorizeRouting()
11+
{
12+
$locator = new FileLocator();
13+
$loader = new XmlFileLoader($locator);
14+
15+
$collection = $loader->load(__DIR__.'/../../Resources/config/routing/authorize.xml');
16+
$authorizeRoute = $collection->get('fos_oauth_server_authorize');
17+
$this->assertEquals('/oauth/v2/auth', $authorizeRoute->getPath());
18+
$this->assertEquals(array('GET', 'POST'), $authorizeRoute->getMethods());
19+
}
20+
21+
public function testLoadTokenRouting()
22+
{
23+
$locator = new FileLocator();
24+
$loader = new XmlFileLoader($locator);
25+
26+
$collection = $loader->load(__DIR__.'/../../Resources/config/routing/token.xml');
27+
$tokenRoute = $collection->get('fos_oauth_server_token');
28+
$this->assertEquals('/oauth/v2/token', $tokenRoute->getPath());
29+
$this->assertEquals(array('GET', 'POST'), $tokenRoute->getMethods());
30+
}
31+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=5.3.3",
2020
"friendsofsymfony/oauth2-php": "~1.1.0",
21-
"symfony/framework-bundle": "~2.1",
21+
"symfony/framework-bundle": "~2.2",
2222
"symfony/security-bundle": "~2.1"
2323
},
2424
"require-dev": {

0 commit comments

Comments
 (0)