diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/GlobalDefaultsClass.php b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/GlobalDefaultsClass.php
new file mode 100644
index 0000000000000..a4acb310c2a80
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/GlobalDefaultsClass.php
@@ -0,0 +1,34 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures;
+
+use Symfony\Component\Routing\Annotation\Route;
+
+/**
+ * @Route("/defaults", locale="g_locale", format="g_format")
+ */
+class GlobalDefaultsClass
+{
+ /**
+ * @Route("/specific-locale", name="specific_locale", locale="s_locale")
+ */
+ public function locale()
+ {
+ }
+
+ /**
+ * @Route("/specific-format", name="specific_format", format="s_format")
+ */
+ public function format()
+ {
+ }
+}
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/Utf8ActionControllers.php b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/Utf8ActionControllers.php
new file mode 100644
index 0000000000000..ea5505f779efb
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/Utf8ActionControllers.php
@@ -0,0 +1,25 @@
+add('defaults', '/defaults')
+ ->locale('en')
+ ->format('html')
+ ;
+};
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/defaults.xml b/src/Symfony/Component/Routing/Tests/Fixtures/defaults.xml
new file mode 100644
index 0000000000000..dfa9153a86b11
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/defaults.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/defaults.yml b/src/Symfony/Component/Routing/Tests/Fixtures/defaults.yml
new file mode 100644
index 0000000000000..a563ae084b7c2
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/defaults.yml
@@ -0,0 +1,4 @@
+defaults:
+ path: /defaults
+ locale: en
+ format: html
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.php b/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.php
new file mode 100644
index 0000000000000..3606f3e662698
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.php
@@ -0,0 +1,10 @@
+add('one', '/one')
+ ->add('two', '/two')->defaults(['specific' => 'imported'])
+ ;
+};
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.xml b/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.xml
new file mode 100644
index 0000000000000..64fd35b799ee2
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ imported
+
+
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.yml b/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.yml
new file mode 100644
index 0000000000000..9af819067f6f5
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/imported-with-defaults.yml
@@ -0,0 +1,7 @@
+one:
+ path: /one
+
+two:
+ path: /two
+ defaults:
+ specific: imported
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.php b/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.php
new file mode 100644
index 0000000000000..6ac9d69e623ba
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.php
@@ -0,0 +1,11 @@
+import('imported-with-defaults.php')
+ ->prefix('/defaults')
+ ->locale('g_locale')
+ ->format('g_format')
+ ;
+};
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.xml b/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.xml
new file mode 100644
index 0000000000000..bdd25318d5101
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.yml b/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.yml
new file mode 100644
index 0000000000000..2e7d59002145b
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/importer-with-defaults.yml
@@ -0,0 +1,5 @@
+defaults:
+ resource: imported-with-defaults.yml
+ prefix: /defaults
+ locale: g_locale
+ format: g_format
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.php b/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.php
new file mode 100644
index 0000000000000..a32189fb99282
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.php
@@ -0,0 +1,10 @@
+add('utf8_one', '/one')
+ ->add('utf8_two', '/two')
+ ;
+};
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.xml b/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.xml
new file mode 100644
index 0000000000000..751d5c5441da8
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.yml b/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.yml
new file mode 100644
index 0000000000000..f04e7ac731385
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/localized/imported-with-utf8.yml
@@ -0,0 +1,5 @@
+utf8_one:
+ path: /one
+
+utf8_two:
+ path: /two
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.php b/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.php
new file mode 100644
index 0000000000000..105528dda43df
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.php
@@ -0,0 +1,7 @@
+import('imported-with-utf8.php')->utf8();
+};
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.xml b/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.xml
new file mode 100644
index 0000000000000..20f8e38ee1b43
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.yml b/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.yml
new file mode 100644
index 0000000000000..20ad443bb1770
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/localized/importer-with-utf8.yml
@@ -0,0 +1,3 @@
+utf8_routes:
+ resource: imported-with-utf8.yml
+ utf8: true
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/localized/utf8.php b/src/Symfony/Component/Routing/Tests/Fixtures/localized/utf8.php
new file mode 100644
index 0000000000000..e7826d0a7896b
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/localized/utf8.php
@@ -0,0 +1,10 @@
+add('some_route', '/')
+ ->add('some_utf8_route', '/utf8')->utf8()
+ ;
+};
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/localized/utf8.yml b/src/Symfony/Component/Routing/Tests/Fixtures/localized/utf8.yml
new file mode 100644
index 0000000000000..3154c83fd0020
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/localized/utf8.yml
@@ -0,0 +1,6 @@
+some_route:
+ path: /
+
+some_utf8_route:
+ path: /utf8
+ utf8: true
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
index 74dfcf8f49ff8..95dbe0f714793 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
@@ -20,6 +20,7 @@
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\ActionPathController;
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\DefaultValueController;
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\ExplicitLocalizedActionPathController;
+use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\GlobalDefaultsClass;
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\InvokableController;
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\InvokableLocalizedController;
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\LocalizedActionPathController;
@@ -35,6 +36,7 @@
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\PrefixedActionPathController;
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\RequirementsWithoutPlaceholderNameController;
use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\RouteWithPrefixController;
+use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\Utf8ActionControllers;
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
{
@@ -157,6 +159,32 @@ public function testInvokableClassRouteLoadWithMethodAnnotation()
$this->assertEquals('/the/path', $routes->get('post.en')->getPath());
}
+ public function testGlobalDefaultsRoutesLoadWithAnnotation()
+ {
+ $routes = $this->loader->load(GlobalDefaultsClass::class);
+ $this->assertCount(2, $routes);
+
+ $specificLocaleRoute = $routes->get('specific_locale');
+
+ $this->assertSame('/defaults/specific-locale', $specificLocaleRoute->getPath());
+ $this->assertSame('s_locale', $specificLocaleRoute->getDefault('_locale'));
+ $this->assertSame('g_format', $specificLocaleRoute->getDefault('_format'));
+
+ $specificFormatRoute = $routes->get('specific_format');
+
+ $this->assertSame('/defaults/specific-format', $specificFormatRoute->getPath());
+ $this->assertSame('g_locale', $specificFormatRoute->getDefault('_locale'));
+ $this->assertSame('s_format', $specificFormatRoute->getDefault('_format'));
+ }
+
+ public function testUtf8RoutesLoadWithAnnotation()
+ {
+ $routes = $this->loader->load(Utf8ActionControllers::class);
+ $this->assertCount(2, $routes);
+ $this->assertTrue($routes->get('one')->getOption('utf8'), 'The route must accept utf8');
+ $this->assertFalse($routes->get('two')->getOption('utf8'), 'The route must not accept utf8');
+ }
+
public function testRouteWithPathWithPrefix()
{
$routes = $this->loader->load(PrefixedActionPathController::class);
diff --git a/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
index fcde870373489..71f9df15470a1 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
@@ -84,6 +84,80 @@ public function testThatDefiningVariableInConfigFileHasNoSideEffects()
);
}
+ public function testLoadingRouteWithDefaults()
+ {
+ $loader = new PhpFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
+ $routes = $loader->load('defaults.php');
+
+ $this->assertCount(1, $routes);
+
+ $defaultsRoute = $routes->get('defaults');
+
+ $this->assertSame('/defaults', $defaultsRoute->getPath());
+ $this->assertSame('en', $defaultsRoute->getDefault('_locale'));
+ $this->assertSame('html', $defaultsRoute->getDefault('_format'));
+ }
+
+ public function testLoadingImportedRoutesWithDefaults()
+ {
+ $loader = new PhpFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
+ $routes = $loader->load('importer-with-defaults.php');
+
+ $this->assertCount(2, $routes);
+
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('one', $localeRoute = new Route('/defaults/one'));
+ $localeRoute->setDefault('_locale', 'g_locale');
+ $localeRoute->setDefault('_format', 'g_format');
+ $expectedRoutes->add('two', $formatRoute = new Route('/defaults/two'));
+ $formatRoute->setDefault('_locale', 'g_locale');
+ $formatRoute->setDefault('_format', 'g_format');
+ $formatRoute->setDefault('specific', 'imported');
+
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/imported-with-defaults.php'));
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/importer-with-defaults.php'));
+
+ $this->assertEquals($expectedRoutes, $routes);
+ }
+
+ public function testLoadingUtf8Route()
+ {
+ $loader = new PhpFileLoader(new FileLocator([__DIR__.'/../Fixtures/localized']));
+ $routes = $loader->load('utf8.php');
+
+ $this->assertCount(2, $routes);
+
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('some_route', new Route('/'));
+
+ $expectedRoutes->add('some_utf8_route', $route = new Route('/utf8'));
+ $route->setOption('utf8', true);
+
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/utf8.php'));
+
+ $this->assertEquals($expectedRoutes, $routes);
+ }
+
+ public function testLoadingUtf8ImportedRoutes()
+ {
+ $loader = new PhpFileLoader(new FileLocator([__DIR__.'/../Fixtures/localized']));
+ $routes = $loader->load('importer-with-utf8.php');
+
+ $this->assertCount(2, $routes);
+
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('utf8_one', $one = new Route('/one'));
+ $one->setOption('utf8', true);
+
+ $expectedRoutes->add('utf8_two', $two = new Route('/two'));
+ $two->setOption('utf8', true);
+
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/imported-with-utf8.php'));
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/importer-with-utf8.php'));
+
+ $this->assertEquals($expectedRoutes, $routes);
+ }
+
public function testRoutingConfigurator()
{
$locator = new FileLocator([__DIR__.'/../Fixtures']);
diff --git a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
index c4fe699a40d79..da86e6308cbd9 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
@@ -13,7 +13,10 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Loader\XmlFileLoader;
+use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Tests\Fixtures\CustomXmlFileLoader;
class XmlFileLoaderTest extends TestCase
@@ -83,24 +86,79 @@ public function testLoadWithImport()
}
}
- public function testUtf8Route()
+ public function testLoadingRouteWithDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
+ $routes = $loader->load('defaults.xml');
+
+ $this->assertCount(1, $routes);
+
+ $defaultsRoute = $routes->get('defaults');
+
+ $this->assertSame('/defaults', $defaultsRoute->getPath());
+ $this->assertSame('en', $defaultsRoute->getDefault('_locale'));
+ $this->assertSame('html', $defaultsRoute->getDefault('_format'));
+ }
+
+ public function testLoadingImportedRoutesWithDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
+ $routes = $loader->load('importer-with-defaults.xml');
+
+ $this->assertCount(2, $routes);
+
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('one', $localeRoute = new Route('/defaults/one'));
+ $localeRoute->setDefault('_locale', 'g_locale');
+ $localeRoute->setDefault('_format', 'g_format');
+ $expectedRoutes->add('two', $formatRoute = new Route('/defaults/two'));
+ $formatRoute->setDefault('_locale', 'g_locale');
+ $formatRoute->setDefault('_format', 'g_format');
+ $formatRoute->setDefault('specific', 'imported');
+
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/imported-with-defaults.xml'));
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/importer-with-defaults.xml'));
+
+ $this->assertEquals($expectedRoutes, $routes);
+ }
+
+ public function testLoadingUtf8Route()
{
$loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/localized']));
- $routeCollection = $loader->load('utf8.xml');
- $routes = $routeCollection->all();
+ $routes = $loader->load('utf8.xml');
- $this->assertCount(2, $routes, 'Two routes are loaded');
- $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
+ $this->assertCount(2, $routes);
+
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('app_utf8', $route = new Route('/utf8'));
+ $route->setOption('utf8', true);
+
+ $expectedRoutes->add('app_no_utf8', $route = new Route('/no-utf8'));
+ $route->setOption('utf8', false);
+
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/utf8.xml'));
+
+ $this->assertEquals($expectedRoutes, $routes);
+ }
+
+ public function testLoadingUtf8ImportedRoutes()
+ {
+ $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/localized']));
+ $routes = $loader->load('importer-with-utf8.xml');
+
+ $this->assertCount(2, $routes);
- $utf8Route = $routeCollection->get('app_utf8');
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('utf8_one', $one = new Route('/one'));
+ $one->setOption('utf8', true);
- $this->assertSame('/utf8', $utf8Route->getPath());
- $this->assertTrue($utf8Route->getOption('utf8'), 'Must be utf8');
+ $expectedRoutes->add('utf8_two', $two = new Route('/two'));
+ $two->setOption('utf8', true);
- $noUtf8Route = $routeCollection->get('app_no_utf8');
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/imported-with-utf8.xml'));
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/importer-with-utf8.xml'));
- $this->assertSame('/no-utf8', $noUtf8Route->getPath());
- $this->assertFalse($noUtf8Route->getOption('utf8'), 'Must not be utf8');
+ $this->assertEquals($expectedRoutes, $routes);
}
public function testLoadLocalized()
diff --git a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
index 296bbe4226b89..ad7720884fd56 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
@@ -15,6 +15,8 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Loader\YamlFileLoader;
+use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
class YamlFileLoaderTest extends TestCase
{
@@ -222,6 +224,80 @@ public function testRemoteSourcesAreNotAccepted()
$loader->load('http://remote.com/here.yml');
}
+ public function testLoadingRouteWithDefaults()
+ {
+ $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
+ $routes = $loader->load('defaults.yml');
+
+ $this->assertCount(1, $routes);
+
+ $defaultsRoute = $routes->get('defaults');
+
+ $this->assertSame('/defaults', $defaultsRoute->getPath());
+ $this->assertSame('en', $defaultsRoute->getDefault('_locale'));
+ $this->assertSame('html', $defaultsRoute->getDefault('_format'));
+ }
+
+ public function testLoadingImportedRoutesWithDefaults()
+ {
+ $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
+ $routes = $loader->load('importer-with-defaults.yml');
+
+ $this->assertCount(2, $routes);
+
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('one', $localeRoute = new Route('/defaults/one'));
+ $localeRoute->setDefault('_locale', 'g_locale');
+ $localeRoute->setDefault('_format', 'g_format');
+ $expectedRoutes->add('two', $formatRoute = new Route('/defaults/two'));
+ $formatRoute->setDefault('_locale', 'g_locale');
+ $formatRoute->setDefault('_format', 'g_format');
+ $formatRoute->setDefault('specific', 'imported');
+
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/imported-with-defaults.yml'));
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/importer-with-defaults.yml'));
+
+ $this->assertEquals($expectedRoutes, $routes);
+ }
+
+ public function testLoadingUtf8Route()
+ {
+ $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/localized']));
+ $routes = $loader->load('utf8.yml');
+
+ $this->assertCount(2, $routes);
+
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('some_route', new Route('/'));
+
+ $expectedRoutes->add('some_utf8_route', $route = new Route('/utf8'));
+ $route->setOption('utf8', true);
+
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/utf8.yml'));
+
+ $this->assertEquals($expectedRoutes, $routes);
+ }
+
+ public function testLoadingUtf8ImportedRoutes()
+ {
+ $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/localized']));
+ $routes = $loader->load('importer-with-utf8.yml');
+
+ $this->assertCount(2, $routes);
+
+ $expectedRoutes = new RouteCollection();
+ $expectedRoutes->add('utf8_one', $one = new Route('/one'));
+ $one->setOption('utf8', true);
+
+ $expectedRoutes->add('utf8_two', $two = new Route('/two'));
+ $two->setOption('utf8', true);
+
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/imported-with-utf8.yml'));
+ $expectedRoutes->addResource(new FileResource(__DIR__.'/../Fixtures/localized/importer-with-utf8.yml'));
+
+ $this->assertEquals($expectedRoutes, $routes);
+ }
+
public function testLoadingLocalizedRoute()
{
$loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/localized']));
diff --git a/src/Symfony/Component/Routing/composer.json b/src/Symfony/Component/Routing/composer.json
index d99d703eeef8e..77d7ce981c82e 100644
--- a/src/Symfony/Component/Routing/composer.json
+++ b/src/Symfony/Component/Routing/composer.json
@@ -24,7 +24,7 @@
"symfony/yaml": "~3.4|~4.0",
"symfony/expression-language": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
- "doctrine/annotations": "~1.0",
+ "doctrine/annotations": "~1.2",
"psr/log": "~1.0"
},
"conflict": {
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy