diff --git a/.travis.yml b/.travis.yml index 84d11b7..bdfec26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ matrix: fast_finish: true allow_failures: - php: hhvm - - env: SYMFONY_VERSION='2.7.*@dev' + - env: SYMFONY_VERSION='2.8.*@dev' - php: 7.0 include: - php: 5.4 @@ -16,7 +16,9 @@ matrix: - php: 5.4 env: SYMFONY_VERSION='2.6.*' - php: 5.4 - env: SYMFONY_VERSION='2.7.*@dev' + env: SYMFONY_VERSION='2.7.*' + - php: 5.4 + env: SYMFONY_VERSION='2.8.*@dev' before_script: - composer selfupdate @@ -24,7 +26,7 @@ before_script: - phantomjs --version - phantomjs --webdriver=4444 & - php -S localhost:8080 -t features/Context/fixtures & - + script: - ./bin/phpspec run -fpretty - ./bin/behat --verbose diff --git a/Routing/Loader/ConventionalLoader.php b/Routing/Loader/ConventionalLoader.php index 28eb5b1..a6775cd 100644 --- a/Routing/Loader/ConventionalLoader.php +++ b/Routing/Loader/ConventionalLoader.php @@ -14,7 +14,7 @@ class ConventionalLoader extends YamlFileLoader 'prefix', 'defaults', 'requirements', 'options', 'collections', 'resources' ); private static $supportedActionKeys = array( - 'pattern', 'defaults', 'requirements', 'options' + 'pattern', 'defaults', 'requirements', 'options', 'methods' ); private $yaml; @@ -370,6 +370,9 @@ private function overrideRouteParams($shortname, Route $route, $params) if (isset($params['options'])) { $route->setOptions($params['options']); } + if (isset($params['methods'])) { + $route->setMethods($params['methods']); + } } } diff --git a/composer.json b/composer.json index 9741815..a7b11a8 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": ">=5.4", - "symfony/symfony": "~2.4,<2.7", + "symfony/symfony": "~2.4", "nelmio/alice": "~1.5", "fzaninotto/faker": "~1.2" }, diff --git a/features/csrf_protection.feature b/features/csrf_protection.feature index 42af3d4..7c9e0d7 100644 --- a/features/csrf_protection.feature +++ b/features/csrf_protection.feature @@ -23,10 +23,10 @@ Feature: CSRF protection for unsafe requests App:Foo:show: ~ App:Foo:delete: defaults: { _check_csrf: true } - requirements: { method: delete } + methods: GET|DELETE App:Foo:deleteUnsafe: defaults: { _check_csrf: false, _controller: App:Foo:delete } - requirements: { method: delete } + methods: DELETE """ And I write in "App/Resources/views/Foo/show.html.twig": """ diff --git a/spec/Knp/RadBundle/Routing/Loader/ConventionalLoaderSpec.php b/spec/Knp/RadBundle/Routing/Loader/ConventionalLoaderSpec.php index 154b039..6c378da 100644 --- a/spec/Knp/RadBundle/Routing/Loader/ConventionalLoaderSpec.php +++ b/spec/Knp/RadBundle/Routing/Loader/ConventionalLoaderSpec.php @@ -446,7 +446,7 @@ function it_should_throw_exception_if_unsupported_action_route_param_provided($y )); $this->shouldThrow(new InvalidArgumentException( - '`unsopported_key` parameter is not supported by `App:Admin\Cheeses:show` action route. Use one of [pattern, defaults, requirements, options].' + '`unsopported_key` parameter is not supported by `App:Admin\Cheeses:show` action route. Use one of [pattern, defaults, requirements, options, methods].' ))->duringLoad('routing.yml'); }