diff --git a/Tests/Fixtures/Routes/routes_with_options.xml b/Tests/Fixtures/Routes/routes_with_options_requirements_and_defaults.xml similarity index 83% rename from Tests/Fixtures/Routes/routes_with_options.xml rename to Tests/Fixtures/Routes/routes_with_options_requirements_and_defaults.xml index 4454b1785..ec733a868 100644 --- a/Tests/Fixtures/Routes/routes_with_options.xml +++ b/Tests/Fixtures/Routes/routes_with_options_requirements_and_defaults.xml @@ -7,5 +7,7 @@ FOSRestBundle:UsersController:getUsers + [a-z]+ + home diff --git a/Tests/Fixtures/Routes/routes_with_options.yml b/Tests/Fixtures/Routes/routes_with_options_requirements_and_defaults.yml similarity index 66% rename from Tests/Fixtures/Routes/routes_with_options.yml rename to Tests/Fixtures/Routes/routes_with_options_requirements_and_defaults.yml index 03a80859c..4afc952aa 100644 --- a/Tests/Fixtures/Routes/routes_with_options.yml +++ b/Tests/Fixtures/Routes/routes_with_options_requirements_and_defaults.yml @@ -3,3 +3,7 @@ users: resource: FOS\RestBundle\Tests\Fixtures\Controller\UsersController options: expose: true + requirements: + slug: "[a-z]+" + defaults: + slug: home diff --git a/Tests/Routing/Loader/RestXmlCollectionLoaderTest.php b/Tests/Routing/Loader/RestXmlCollectionLoaderTest.php index 9816cbf55..6bc35bbc3 100644 --- a/Tests/Routing/Loader/RestXmlCollectionLoaderTest.php +++ b/Tests/Routing/Loader/RestXmlCollectionLoaderTest.php @@ -109,21 +109,14 @@ public function testManualRoutesWithDefaultFormat() $this->assertEquals('xml', $route->getDefault('_format')); } - public function testForwardOptions() + public function testForwardOptionsRequirementsAndDefaults() { - $collection = $this->loadFromXmlCollectionFixture( - 'routes_with_options.xml', - true, - array( - 'json' => false, - 'xml' => false, - 'html' => true, - ), - 'xml' - ); + $collection = $this->loadFromXmlCollectionFixture('routes_with_options_requirements_and_defaults.xml'); foreach ($collection as $route) { $this->assertTrue('true' === $route->getOption('expose')); + $this->assertEquals('[a-z]+', $route->getRequirement('slug')); + $this->assertEquals('home', $route->getDefault('slug')); } } /** diff --git a/Tests/Routing/Loader/RestYamlCollectionLoaderTest.php b/Tests/Routing/Loader/RestYamlCollectionLoaderTest.php index bcafc64e2..437acaacd 100644 --- a/Tests/Routing/Loader/RestYamlCollectionLoaderTest.php +++ b/Tests/Routing/Loader/RestYamlCollectionLoaderTest.php @@ -92,12 +92,14 @@ public function testNamedPrefixedReportsFixtureHasNoDuplicates() $this->assertEquals(count($names), count(array_unique($names))); } - public function testForwardOptions() + public function testForwardOptionsRequirementsAndDefaults() { - $collection = $this->loadFromYamlCollectionFixture('routes_with_options.yml'); + $collection = $this->loadFromYamlCollectionFixture('routes_with_options_requirements_and_defaults.yml'); foreach ($collection as $route) { $this->assertTrue($route->getOption('expose')); + $this->assertEquals('[a-z]+', $route->getRequirement('slug')); + $this->assertEquals('home', $route->getDefault('slug')); } }