aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/symfony/routing/Tests/Loader
diff options
context:
space:
mode:
authormarvin-borner@live.com2018-04-10 21:50:16 +0200
committermarvin-borner@live.com2018-04-10 21:54:48 +0200
commitfc9401f04a3aca5abb22f87ebc210de8afe11d32 (patch)
treeb0b310f3581764ec3955f4e496a05137a32951c3 /assets/php/vendor/symfony/routing/Tests/Loader
parent286d643180672f20526f3dc3bd19d7b751e2fa97 (diff)
Initial Commit
Diffstat (limited to 'assets/php/vendor/symfony/routing/Tests/Loader')
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php33
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php255
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php98
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php91
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php49
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php74
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php45
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php123
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php133
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php385
-rw-r--r--assets/php/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php206
11 files changed, 1492 insertions, 0 deletions
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php
new file mode 100644
index 0000000..e8bbe8f
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php
@@ -0,0 +1,33 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use PHPUnit\Framework\TestCase;
+
+abstract class AbstractAnnotationLoaderTest extends TestCase
+{
+ public function getReader()
+ {
+ return $this->getMockBuilder('Doctrine\Common\Annotations\Reader')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ;
+ }
+
+ public function getClassLoader($reader)
+ {
+ return $this->getMockBuilder('Symfony\Component\Routing\Loader\AnnotationClassLoader')
+ ->setConstructorArgs(array($reader))
+ ->getMockForAbstractClass()
+ ;
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php
new file mode 100644
index 0000000..70db1cc
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php
@@ -0,0 +1,255 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use Symfony\Component\Routing\Annotation\Route;
+
+class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
+{
+ protected $loader;
+ private $reader;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->reader = $this->getReader();
+ $this->loader = $this->getClassLoader($this->reader);
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testLoadMissingClass()
+ {
+ $this->loader->load('MissingClass');
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testLoadAbstractClass()
+ {
+ $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\AbstractClass');
+ }
+
+ /**
+ * @dataProvider provideTestSupportsChecksResource
+ */
+ public function testSupportsChecksResource($resource, $expectedSupports)
+ {
+ $this->assertSame($expectedSupports, $this->loader->supports($resource), '->supports() returns true if the resource is loadable');
+ }
+
+ public function provideTestSupportsChecksResource()
+ {
+ return array(
+ array('class', true),
+ array('\fully\qualified\class\name', true),
+ array('namespaced\class\without\leading\slash', true),
+ array('ÿClassWithLegalSpecialCharacters', true),
+ array('5', false),
+ array('foo.foo', false),
+ array(null, false),
+ );
+ }
+
+ public function testSupportsChecksTypeIfSpecified()
+ {
+ $this->assertTrue($this->loader->supports('class', 'annotation'), '->supports() checks the resource type if specified');
+ $this->assertFalse($this->loader->supports('class', 'foo'), '->supports() checks the resource type if specified');
+ }
+
+ public function getLoadTests()
+ {
+ return array(
+ array(
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
+ array('name' => 'route1', 'path' => '/path'),
+ array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'),
+ ),
+ array(
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
+ array('defaults' => array('arg2' => 'foo'), 'requirements' => array('arg3' => '\w+')),
+ array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'),
+ ),
+ array(
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
+ array('options' => array('foo' => 'bar')),
+ array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'),
+ ),
+ array(
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
+ array('schemes' => array('https'), 'methods' => array('GET')),
+ array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'),
+ ),
+ array(
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
+ array('condition' => 'context.getMethod() == "GET"'),
+ array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider getLoadTests
+ */
+ public function testLoad($className, $routeData = array(), $methodArgs = array())
+ {
+ $routeData = array_replace(array(
+ 'name' => 'route',
+ 'path' => '/',
+ 'requirements' => array(),
+ 'options' => array(),
+ 'defaults' => array(),
+ 'schemes' => array(),
+ 'methods' => array(),
+ 'condition' => '',
+ ), $routeData);
+
+ $this->reader
+ ->expects($this->once())
+ ->method('getMethodAnnotations')
+ ->will($this->returnValue(array($this->getAnnotatedRoute($routeData))))
+ ;
+
+ $routeCollection = $this->loader->load($className);
+ $route = $routeCollection->get($routeData['name']);
+
+ $this->assertSame($routeData['path'], $route->getPath(), '->load preserves path annotation');
+ $this->assertCount(
+ count($routeData['requirements']),
+ array_intersect_assoc($routeData['requirements'], $route->getRequirements()),
+ '->load preserves requirements annotation'
+ );
+ $this->assertCount(
+ count($routeData['options']),
+ array_intersect_assoc($routeData['options'], $route->getOptions()),
+ '->load preserves options annotation'
+ );
+ $this->assertCount(
+ count($routeData['defaults']),
+ $route->getDefaults(),
+ '->load preserves defaults annotation'
+ );
+ $this->assertEquals($routeData['schemes'], $route->getSchemes(), '->load preserves schemes annotation');
+ $this->assertEquals($routeData['methods'], $route->getMethods(), '->load preserves methods annotation');
+ $this->assertSame($routeData['condition'], $route->getCondition(), '->load preserves condition annotation');
+ }
+
+ public function testClassRouteLoad()
+ {
+ $classRouteData = array(
+ 'name' => 'prefix_',
+ 'path' => '/prefix',
+ 'schemes' => array('https'),
+ 'methods' => array('GET'),
+ );
+
+ $methodRouteData = array(
+ 'name' => 'route1',
+ 'path' => '/path',
+ 'schemes' => array('http'),
+ 'methods' => array('POST', 'PUT'),
+ );
+
+ $this->reader
+ ->expects($this->once())
+ ->method('getClassAnnotation')
+ ->will($this->returnValue($this->getAnnotatedRoute($classRouteData)))
+ ;
+ $this->reader
+ ->expects($this->once())
+ ->method('getMethodAnnotations')
+ ->will($this->returnValue(array($this->getAnnotatedRoute($methodRouteData))))
+ ;
+
+ $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass');
+ $route = $routeCollection->get($classRouteData['name'].$methodRouteData['name']);
+
+ $this->assertSame($classRouteData['path'].$methodRouteData['path'], $route->getPath(), '->load concatenates class and method route path');
+ $this->assertEquals(array_merge($classRouteData['schemes'], $methodRouteData['schemes']), $route->getSchemes(), '->load merges class and method route schemes');
+ $this->assertEquals(array_merge($classRouteData['methods'], $methodRouteData['methods']), $route->getMethods(), '->load merges class and method route methods');
+ }
+
+ public function testInvokableClassRouteLoad()
+ {
+ $classRouteData = array(
+ 'name' => 'route1',
+ 'path' => '/',
+ 'schemes' => array('https'),
+ 'methods' => array('GET'),
+ );
+
+ $this->reader
+ ->expects($this->exactly(2))
+ ->method('getClassAnnotation')
+ ->will($this->returnValue($this->getAnnotatedRoute($classRouteData)))
+ ;
+ $this->reader
+ ->expects($this->once())
+ ->method('getMethodAnnotations')
+ ->will($this->returnValue(array()))
+ ;
+
+ $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass');
+ $route = $routeCollection->get($classRouteData['name']);
+
+ $this->assertSame($classRouteData['path'], $route->getPath(), '->load preserves class route path');
+ $this->assertEquals(array_merge($classRouteData['schemes'], $classRouteData['schemes']), $route->getSchemes(), '->load preserves class route schemes');
+ $this->assertEquals(array_merge($classRouteData['methods'], $classRouteData['methods']), $route->getMethods(), '->load preserves class route methods');
+ }
+
+ public function testInvokableClassWithMethodRouteLoad()
+ {
+ $classRouteData = array(
+ 'name' => 'route1',
+ 'path' => '/prefix',
+ 'schemes' => array('https'),
+ 'methods' => array('GET'),
+ );
+
+ $methodRouteData = array(
+ 'name' => 'route2',
+ 'path' => '/path',
+ 'schemes' => array('http'),
+ 'methods' => array('POST', 'PUT'),
+ );
+
+ $this->reader
+ ->expects($this->once())
+ ->method('getClassAnnotation')
+ ->will($this->returnValue($this->getAnnotatedRoute($classRouteData)))
+ ;
+ $this->reader
+ ->expects($this->once())
+ ->method('getMethodAnnotations')
+ ->will($this->returnValue(array($this->getAnnotatedRoute($methodRouteData))))
+ ;
+
+ $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass');
+ $route = $routeCollection->get($classRouteData['name']);
+
+ $this->assertNull($route, '->load ignores class route');
+
+ $route = $routeCollection->get($classRouteData['name'].$methodRouteData['name']);
+
+ $this->assertSame($classRouteData['path'].$methodRouteData['path'], $route->getPath(), '->load concatenates class and method route path');
+ $this->assertEquals(array_merge($classRouteData['schemes'], $methodRouteData['schemes']), $route->getSchemes(), '->load merges class and method route schemes');
+ $this->assertEquals(array_merge($classRouteData['methods'], $methodRouteData['methods']), $route->getMethods(), '->load merges class and method route methods');
+ }
+
+ private function getAnnotatedRoute($data)
+ {
+ return new Route($data);
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
new file mode 100644
index 0000000..1e8ee39
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
@@ -0,0 +1,98 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
+use Symfony\Component\Config\FileLocator;
+
+class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
+{
+ protected $loader;
+ protected $reader;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->reader = $this->getReader();
+ $this->loader = new AnnotationDirectoryLoader(new FileLocator(), $this->getClassLoader($this->reader));
+ }
+
+ public function testLoad()
+ {
+ $this->reader->expects($this->exactly(4))->method('getClassAnnotation');
+
+ $this->reader
+ ->expects($this->any())
+ ->method('getMethodAnnotations')
+ ->will($this->returnValue(array()))
+ ;
+
+ $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
+ }
+
+ public function testLoadIgnoresHiddenDirectories()
+ {
+ $this->expectAnnotationsToBeReadFrom(array(
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass',
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass',
+ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\FooClass',
+ ));
+
+ $this->reader
+ ->expects($this->any())
+ ->method('getMethodAnnotations')
+ ->will($this->returnValue(array()))
+ ;
+
+ $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
+ }
+
+ public function testSupports()
+ {
+ $fixturesDir = __DIR__.'/../Fixtures';
+
+ $this->assertTrue($this->loader->supports($fixturesDir), '->supports() returns true if the resource is loadable');
+ $this->assertFalse($this->loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
+
+ $this->assertTrue($this->loader->supports($fixturesDir, 'annotation'), '->supports() checks the resource type if specified');
+ $this->assertFalse($this->loader->supports($fixturesDir, 'foo'), '->supports() checks the resource type if specified');
+ }
+
+ public function testItSupportsAnyAnnotation()
+ {
+ $this->assertTrue($this->loader->supports(__DIR__.'/../Fixtures/even-with-not-existing-folder', 'annotation'));
+ }
+
+ public function testLoadFileIfLocatedResourceIsFile()
+ {
+ $this->reader->expects($this->exactly(1))->method('getClassAnnotation');
+
+ $this->reader
+ ->expects($this->any())
+ ->method('getMethodAnnotations')
+ ->will($this->returnValue(array()))
+ ;
+
+ $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');
+ }
+
+ private function expectAnnotationsToBeReadFrom(array $classes)
+ {
+ $this->reader->expects($this->exactly(count($classes)))
+ ->method('getClassAnnotation')
+ ->with($this->callback(function (\ReflectionClass $class) use ($classes) {
+ return in_array($class->getName(), $classes);
+ }));
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php
new file mode 100644
index 0000000..7f1d576
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php
@@ -0,0 +1,91 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use Symfony\Component\Routing\Loader\AnnotationFileLoader;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Routing\Annotation\Route;
+
+class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
+{
+ protected $loader;
+ protected $reader;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->reader = $this->getReader();
+ $this->loader = new AnnotationFileLoader(new FileLocator(), $this->getClassLoader($this->reader));
+ }
+
+ public function testLoad()
+ {
+ $this->reader->expects($this->once())->method('getClassAnnotation');
+
+ $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');
+ }
+
+ /**
+ * @requires PHP 5.4
+ */
+ public function testLoadTraitWithClassConstant()
+ {
+ $this->reader->expects($this->never())->method('getClassAnnotation');
+
+ $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooTrait.php');
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Did you forgot to add the "<?php" start tag at the beginning of the file?
+ */
+ public function testLoadFileWithoutStartTag()
+ {
+ $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/NoStartTagClass.php');
+ }
+
+ /**
+ * @requires PHP 5.6
+ */
+ public function testLoadVariadic()
+ {
+ $route = new Route(array('path' => '/path/to/{id}'));
+ $this->reader->expects($this->once())->method('getClassAnnotation');
+ $this->reader->expects($this->once())->method('getMethodAnnotations')
+ ->will($this->returnValue(array($route)));
+
+ $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php');
+ }
+
+ /**
+ * @requires PHP 7.0
+ */
+ public function testLoadAnonymousClass()
+ {
+ $this->reader->expects($this->never())->method('getClassAnnotation');
+ $this->reader->expects($this->never())->method('getMethodAnnotations');
+
+ $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php');
+ }
+
+ public function testSupports()
+ {
+ $fixture = __DIR__.'/../Fixtures/annotated.php';
+
+ $this->assertTrue($this->loader->supports($fixture), '->supports() returns true if the resource is loadable');
+ $this->assertFalse($this->loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
+
+ $this->assertTrue($this->loader->supports($fixture, 'annotation'), '->supports() checks the resource type if specified');
+ $this->assertFalse($this->loader->supports($fixture, 'foo'), '->supports() checks the resource type if specified');
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php
new file mode 100644
index 0000000..5d963f8
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php
@@ -0,0 +1,49 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Routing\Loader\ClosureLoader;
+use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
+
+class ClosureLoaderTest extends TestCase
+{
+ public function testSupports()
+ {
+ $loader = new ClosureLoader();
+
+ $closure = function () {};
+
+ $this->assertTrue($loader->supports($closure), '->supports() returns true if the resource is loadable');
+ $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
+
+ $this->assertTrue($loader->supports($closure, 'closure'), '->supports() checks the resource type if specified');
+ $this->assertFalse($loader->supports($closure, 'foo'), '->supports() checks the resource type if specified');
+ }
+
+ public function testLoad()
+ {
+ $loader = new ClosureLoader();
+
+ $route = new Route('/');
+ $routes = $loader->load(function () use ($route) {
+ $routes = new RouteCollection();
+
+ $routes->add('foo', $route);
+
+ return $routes;
+ });
+
+ $this->assertEquals($route, $routes->get('foo'), '->load() loads a \Closure resource');
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php
new file mode 100644
index 0000000..fc29d37
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php
@@ -0,0 +1,74 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use Symfony\Component\Routing\Loader\DirectoryLoader;
+use Symfony\Component\Routing\Loader\YamlFileLoader;
+use Symfony\Component\Routing\Loader\AnnotationFileLoader;
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Routing\RouteCollection;
+
+class DirectoryLoaderTest extends AbstractAnnotationLoaderTest
+{
+ private $loader;
+ private $reader;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $locator = new FileLocator();
+ $this->reader = $this->getReader();
+ $this->loader = new DirectoryLoader($locator);
+ $resolver = new LoaderResolver(array(
+ new YamlFileLoader($locator),
+ new AnnotationFileLoader($locator, $this->getClassLoader($this->reader)),
+ $this->loader,
+ ));
+ $this->loader->setResolver($resolver);
+ }
+
+ public function testLoadDirectory()
+ {
+ $collection = $this->loader->load(__DIR__.'/../Fixtures/directory', 'directory');
+ $this->verifyCollection($collection);
+ }
+
+ public function testImportDirectory()
+ {
+ $collection = $this->loader->load(__DIR__.'/../Fixtures/directory_import', 'directory');
+ $this->verifyCollection($collection);
+ }
+
+ private function verifyCollection(RouteCollection $collection)
+ {
+ $routes = $collection->all();
+
+ $this->assertCount(3, $routes, 'Three routes are loaded');
+ $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
+
+ for ($i = 1; $i <= 3; ++$i) {
+ $this->assertSame('/route/'.$i, $routes['route'.$i]->getPath());
+ }
+ }
+
+ public function testSupports()
+ {
+ $fixturesDir = __DIR__.'/../Fixtures';
+
+ $this->assertFalse($this->loader->supports($fixturesDir), '->supports(*) returns false');
+
+ $this->assertTrue($this->loader->supports($fixturesDir, 'directory'), '->supports(*, "directory") returns true');
+ $this->assertFalse($this->loader->supports($fixturesDir, 'foo'), '->supports(*, "foo") returns false');
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php
new file mode 100644
index 0000000..08d806a
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php
@@ -0,0 +1,45 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Config\Resource\GlobResource;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Routing\Loader\GlobFileLoader;
+use Symfony\Component\Routing\RouteCollection;
+
+class GlobFileLoaderTest extends TestCase
+{
+ public function testSupports()
+ {
+ $loader = new GlobFileLoader(new FileLocator());
+
+ $this->assertTrue($loader->supports('any-path', 'glob'), '->supports() returns true if the resource has the glob type');
+ $this->assertFalse($loader->supports('any-path'), '->supports() returns false if the resource is not of glob type');
+ }
+
+ public function testLoadAddsTheGlobResourceToTheContainer()
+ {
+ $loader = new GlobFileLoaderWithoutImport(new FileLocator());
+ $collection = $loader->load(__DIR__.'/../Fixtures/directory/*.yml');
+
+ $this->assertEquals(new GlobResource(__DIR__.'/../Fixtures/directory', '/*.yml', false), $collection->getResources()[0]);
+ }
+}
+
+class GlobFileLoaderWithoutImport extends GlobFileLoader
+{
+ public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null)
+ {
+ return new RouteCollection();
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php
new file mode 100644
index 0000000..408fa0b
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php
@@ -0,0 +1,123 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Routing\Loader\ObjectRouteLoader;
+use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
+
+class ObjectRouteLoaderTest extends TestCase
+{
+ public function testLoadCallsServiceAndReturnsCollection()
+ {
+ $loader = new ObjectRouteLoaderForTest();
+
+ // create a basic collection that will be returned
+ $collection = new RouteCollection();
+ $collection->add('foo', new Route('/foo'));
+
+ $loader->loaderMap = array(
+ 'my_route_provider_service' => new RouteService($collection),
+ );
+
+ $actualRoutes = $loader->load(
+ 'my_route_provider_service:loadRoutes',
+ 'service'
+ );
+
+ $this->assertSame($collection, $actualRoutes);
+ // the service file should be listed as a resource
+ $this->assertNotEmpty($actualRoutes->getResources());
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @dataProvider getBadResourceStrings
+ */
+ public function testExceptionWithoutSyntax($resourceString)
+ {
+ $loader = new ObjectRouteLoaderForTest();
+ $loader->load($resourceString);
+ }
+
+ public function getBadResourceStrings()
+ {
+ return array(
+ array('Foo'),
+ array('Bar::baz'),
+ array('Foo:Bar:baz'),
+ );
+ }
+
+ /**
+ * @expectedException \LogicException
+ */
+ public function testExceptionOnNoObjectReturned()
+ {
+ $loader = new ObjectRouteLoaderForTest();
+ $loader->loaderMap = array('my_service' => 'NOT_AN_OBJECT');
+ $loader->load('my_service:method');
+ }
+
+ /**
+ * @expectedException \BadMethodCallException
+ */
+ public function testExceptionOnBadMethod()
+ {
+ $loader = new ObjectRouteLoaderForTest();
+ $loader->loaderMap = array('my_service' => new \stdClass());
+ $loader->load('my_service:method');
+ }
+
+ /**
+ * @expectedException \LogicException
+ */
+ public function testExceptionOnMethodNotReturningCollection()
+ {
+ $service = $this->getMockBuilder('stdClass')
+ ->setMethods(array('loadRoutes'))
+ ->getMock();
+ $service->expects($this->once())
+ ->method('loadRoutes')
+ ->will($this->returnValue('NOT_A_COLLECTION'));
+
+ $loader = new ObjectRouteLoaderForTest();
+ $loader->loaderMap = array('my_service' => $service);
+ $loader->load('my_service:loadRoutes');
+ }
+}
+
+class ObjectRouteLoaderForTest extends ObjectRouteLoader
+{
+ public $loaderMap = array();
+
+ protected function getServiceObject($id)
+ {
+ return isset($this->loaderMap[$id]) ? $this->loaderMap[$id] : null;
+ }
+}
+
+class RouteService
+{
+ private $collection;
+
+ public function __construct($collection)
+ {
+ $this->collection = $collection;
+ }
+
+ public function loadRoutes()
+ {
+ return $this->collection;
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php
new file mode 100644
index 0000000..0dcf5d4
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php
@@ -0,0 +1,133 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Config\Resource\FileResource;
+use Symfony\Component\Routing\Loader\PhpFileLoader;
+use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
+
+class PhpFileLoaderTest extends TestCase
+{
+ public function testSupports()
+ {
+ $loader = new PhpFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
+
+ $this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable');
+ $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
+
+ $this->assertTrue($loader->supports('foo.php', 'php'), '->supports() checks the resource type if specified');
+ $this->assertFalse($loader->supports('foo.php', 'foo'), '->supports() checks the resource type if specified');
+ }
+
+ public function testLoadWithRoute()
+ {
+ $loader = new PhpFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('validpattern.php');
+ $routes = $routeCollection->all();
+
+ $this->assertCount(1, $routes, 'One route is loaded');
+ $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
+
+ foreach ($routes as $route) {
+ $this->assertSame('/blog/{slug}', $route->getPath());
+ $this->assertSame('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
+ $this->assertSame('{locale}.example.com', $route->getHost());
+ $this->assertSame('RouteCompiler', $route->getOption('compiler_class'));
+ $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods());
+ $this->assertEquals(array('https'), $route->getSchemes());
+ }
+ }
+
+ public function testLoadWithImport()
+ {
+ $loader = new PhpFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('validresource.php');
+ $routes = $routeCollection->all();
+
+ $this->assertCount(1, $routes, 'One route is loaded');
+ $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
+
+ foreach ($routes as $route) {
+ $this->assertSame('/prefix/blog/{slug}', $route->getPath());
+ $this->assertSame('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
+ $this->assertSame('{locale}.example.com', $route->getHost());
+ $this->assertSame('RouteCompiler', $route->getOption('compiler_class'));
+ $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods());
+ $this->assertEquals(array('https'), $route->getSchemes());
+ }
+ }
+
+ public function testThatDefiningVariableInConfigFileHasNoSideEffects()
+ {
+ $locator = new FileLocator(array(__DIR__.'/../Fixtures'));
+ $loader = new PhpFileLoader($locator);
+ $routeCollection = $loader->load('with_define_path_variable.php');
+ $resources = $routeCollection->getResources();
+ $this->assertCount(1, $resources);
+ $this->assertContainsOnly('Symfony\Component\Config\Resource\ResourceInterface', $resources);
+ $fileResource = reset($resources);
+ $this->assertSame(
+ realpath($locator->locate('with_define_path_variable.php')),
+ (string) $fileResource
+ );
+ }
+
+ public function testRoutingConfigurator()
+ {
+ $locator = new FileLocator(array(__DIR__.'/../Fixtures'));
+ $loader = new PhpFileLoader($locator);
+ $routeCollection = $loader->load('php_dsl.php');
+
+ $expectedCollection = new RouteCollection();
+
+ $expectedCollection->add('foo', (new Route('/foo'))
+ ->setOptions(array('utf8' => true))
+ ->setCondition('abc')
+ );
+ $expectedCollection->add('buz', (new Route('/zub'))
+ ->setDefaults(array('_controller' => 'foo:act'))
+ );
+ $expectedCollection->add('c_bar', (new Route('/sub/pub/bar'))
+ ->setRequirements(array('id' => '\d+'))
+ );
+ $expectedCollection->add('c_pub_buz', (new Route('/sub/pub/buz'))
+ ->setHost('host')
+ ->setRequirements(array('id' => '\d+'))
+ );
+ $expectedCollection->add('ouf', (new Route('/ouf'))
+ ->setSchemes(array('https'))
+ ->setMethods(array('GET'))
+ ->setDefaults(array('id' => 0))
+ );
+
+ $expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_sub.php')));
+ $expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl.php')));
+
+ $this->assertEquals($expectedCollection, $routeCollection);
+ }
+
+ public function testRoutingConfiguratorCanImportGlobPatterns()
+ {
+ $locator = new FileLocator(array(__DIR__.'/../Fixtures/glob'));
+ $loader = new PhpFileLoader($locator);
+ $routeCollection = $loader->load('php_dsl.php');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('baz_route');
+ $this->assertSame('AppBundle:Baz:view', $route->getDefault('_controller'));
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php
new file mode 100644
index 0000000..21fc340
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php
@@ -0,0 +1,385 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Routing\Loader\XmlFileLoader;
+use Symfony\Component\Routing\Tests\Fixtures\CustomXmlFileLoader;
+
+class XmlFileLoaderTest extends TestCase
+{
+ public function testSupports()
+ {
+ $loader = new XmlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
+
+ $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable');
+ $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
+
+ $this->assertTrue($loader->supports('foo.xml', 'xml'), '->supports() checks the resource type if specified');
+ $this->assertFalse($loader->supports('foo.xml', 'foo'), '->supports() checks the resource type if specified');
+ }
+
+ public function testLoadWithRoute()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('validpattern.xml');
+ $route = $routeCollection->get('blog_show');
+
+ $this->assertInstanceOf('Symfony\Component\Routing\Route', $route);
+ $this->assertSame('/blog/{slug}', $route->getPath());
+ $this->assertSame('{locale}.example.com', $route->getHost());
+ $this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller'));
+ $this->assertSame('\w+', $route->getRequirement('locale'));
+ $this->assertSame('RouteCompiler', $route->getOption('compiler_class'));
+ $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods());
+ $this->assertEquals(array('https'), $route->getSchemes());
+ $this->assertEquals('context.getMethod() == "GET"', $route->getCondition());
+ }
+
+ public function testLoadWithNamespacePrefix()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('namespaceprefix.xml');
+
+ $this->assertCount(1, $routeCollection->all(), 'One route is loaded');
+
+ $route = $routeCollection->get('blog_show');
+ $this->assertSame('/blog/{slug}', $route->getPath());
+ $this->assertSame('{_locale}.example.com', $route->getHost());
+ $this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller'));
+ $this->assertSame('\w+', $route->getRequirement('slug'));
+ $this->assertSame('en|fr|de', $route->getRequirement('_locale'));
+ $this->assertNull($route->getDefault('slug'));
+ $this->assertSame('RouteCompiler', $route->getOption('compiler_class'));
+ $this->assertSame(1, $route->getDefault('page'));
+ }
+
+ public function testLoadWithImport()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('validresource.xml');
+ $routes = $routeCollection->all();
+
+ $this->assertCount(2, $routes, 'Two routes are loaded');
+ $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
+
+ foreach ($routes as $route) {
+ $this->assertSame('/{foo}/blog/{slug}', $route->getPath());
+ $this->assertSame('123', $route->getDefault('foo'));
+ $this->assertSame('\d+', $route->getRequirement('foo'));
+ $this->assertSame('bar', $route->getOption('foo'));
+ $this->assertSame('', $route->getHost());
+ $this->assertSame('context.getMethod() == "POST"', $route->getCondition());
+ }
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @dataProvider getPathsToInvalidFiles
+ */
+ public function testLoadThrowsExceptionWithInvalidFile($filePath)
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $loader->load($filePath);
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @dataProvider getPathsToInvalidFiles
+ */
+ public function testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidation($filePath)
+ {
+ $loader = new CustomXmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $loader->load($filePath);
+ }
+
+ public function getPathsToInvalidFiles()
+ {
+ return array(array('nonvalidnode.xml'), array('nonvalidroute.xml'), array('nonvalid.xml'), array('missing_id.xml'), array('missing_path.xml'));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Document types are not allowed.
+ */
+ public function testDocTypeIsNotAllowed()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $loader->load('withdoctype.xml');
+ }
+
+ public function testNullValues()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('null_values.xml');
+ $route = $routeCollection->get('blog_show');
+
+ $this->assertTrue($route->hasDefault('foo'));
+ $this->assertNull($route->getDefault('foo'));
+ $this->assertTrue($route->hasDefault('bar'));
+ $this->assertNull($route->getDefault('bar'));
+ $this->assertEquals('foo', $route->getDefault('foobar'));
+ $this->assertEquals('bar', $route->getDefault('baz'));
+ }
+
+ public function testScalarDataTypeDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('scalar_defaults.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(
+ array(
+ '_controller' => 'AcmeBlogBundle:Blog:index',
+ 'slug' => null,
+ 'published' => true,
+ 'page' => 1,
+ 'price' => 3.5,
+ 'archived' => false,
+ 'free' => true,
+ 'locked' => false,
+ 'foo' => null,
+ 'bar' => null,
+ ),
+ $route->getDefaults()
+ );
+ }
+
+ public function testListDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('list_defaults.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(
+ array(
+ '_controller' => 'AcmeBlogBundle:Blog:index',
+ 'values' => array(true, 1, 3.5, 'foo'),
+ ),
+ $route->getDefaults()
+ );
+ }
+
+ public function testListInListDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('list_in_list_defaults.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(
+ array(
+ '_controller' => 'AcmeBlogBundle:Blog:index',
+ 'values' => array(array(true, 1, 3.5, 'foo')),
+ ),
+ $route->getDefaults()
+ );
+ }
+
+ public function testListInMapDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('list_in_map_defaults.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(
+ array(
+ '_controller' => 'AcmeBlogBundle:Blog:index',
+ 'values' => array('list' => array(true, 1, 3.5, 'foo')),
+ ),
+ $route->getDefaults()
+ );
+ }
+
+ public function testMapDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('map_defaults.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(
+ array(
+ '_controller' => 'AcmeBlogBundle:Blog:index',
+ 'values' => array(
+ 'public' => true,
+ 'page' => 1,
+ 'price' => 3.5,
+ 'title' => 'foo',
+ ),
+ ),
+ $route->getDefaults()
+ );
+ }
+
+ public function testMapInListDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('map_in_list_defaults.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(
+ array(
+ '_controller' => 'AcmeBlogBundle:Blog:index',
+ 'values' => array(array(
+ 'public' => true,
+ 'page' => 1,
+ 'price' => 3.5,
+ 'title' => 'foo',
+ )),
+ ),
+ $route->getDefaults()
+ );
+ }
+
+ public function testMapInMapDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('map_in_map_defaults.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(
+ array(
+ '_controller' => 'AcmeBlogBundle:Blog:index',
+ 'values' => array('map' => array(
+ 'public' => true,
+ 'page' => 1,
+ 'price' => 3.5,
+ 'title' => 'foo',
+ )),
+ ),
+ $route->getDefaults()
+ );
+ }
+
+ public function testNullValuesInList()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('list_null_values.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(array(null, null, null, null, null, null), $route->getDefault('list'));
+ }
+
+ public function testNullValuesInMap()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('map_null_values.xml');
+ $route = $routeCollection->get('blog');
+
+ $this->assertSame(
+ array(
+ 'boolean' => null,
+ 'integer' => null,
+ 'float' => null,
+ 'string' => null,
+ 'list' => null,
+ 'map' => null,
+ ),
+ $route->getDefault('map')
+ );
+ }
+
+ public function testLoadRouteWithControllerAttribute()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $routeCollection = $loader->load('routing.xml');
+
+ $route = $routeCollection->get('app_homepage');
+
+ $this->assertSame('AppBundle:Homepage:show', $route->getDefault('_controller'));
+ }
+
+ public function testLoadRouteWithoutControllerAttribute()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $routeCollection = $loader->load('routing.xml');
+
+ $route = $routeCollection->get('app_logout');
+
+ $this->assertNull($route->getDefault('_controller'));
+ }
+
+ public function testLoadRouteWithControllerSetInDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $routeCollection = $loader->load('routing.xml');
+
+ $route = $routeCollection->get('app_blog');
+
+ $this->assertSame('AppBundle:Blog:list', $route->getDefault('_controller'));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" attribute and the defaults key "_controller" for "app_blog"/
+ */
+ public function testOverrideControllerInDefaults()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $loader->load('override_defaults.xml');
+ }
+
+ /**
+ * @dataProvider provideFilesImportingRoutesWithControllers
+ */
+ public function testImportRouteWithController($file)
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $routeCollection = $loader->load($file);
+
+ $route = $routeCollection->get('app_homepage');
+ $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('app_blog');
+ $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('app_logout');
+ $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller'));
+ }
+
+ public function provideFilesImportingRoutesWithControllers()
+ {
+ yield array('import_controller.xml');
+ yield array('import__controller.xml');
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" attribute and the defaults key "_controller" for the "import" tag/
+ */
+ public function testImportWithOverriddenController()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $loader->load('import_override_defaults.xml');
+ }
+
+ public function testImportRouteWithGlobMatchingSingleFile()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob')));
+ $routeCollection = $loader->load('import_single.xml');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+ }
+
+ public function testImportRouteWithGlobMatchingMultipleFiles()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob')));
+ $routeCollection = $loader->load('import_multiple.xml');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('baz_route');
+ $this->assertSame('AppBundle:Baz:view', $route->getDefault('_controller'));
+ }
+}
diff --git a/assets/php/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php b/assets/php/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php
new file mode 100644
index 0000000..822bddf
--- /dev/null
+++ b/assets/php/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php
@@ -0,0 +1,206 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Routing\Loader\YamlFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class YamlFileLoaderTest extends TestCase
+{
+ public function testSupports()
+ {
+ $loader = new YamlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock());
+
+ $this->assertTrue($loader->supports('foo.yml'), '->supports() returns true if the resource is loadable');
+ $this->assertTrue($loader->supports('foo.yaml'), '->supports() returns true if the resource is loadable');
+ $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
+
+ $this->assertTrue($loader->supports('foo.yml', 'yaml'), '->supports() checks the resource type if specified');
+ $this->assertTrue($loader->supports('foo.yaml', 'yaml'), '->supports() checks the resource type if specified');
+ $this->assertFalse($loader->supports('foo.yml', 'foo'), '->supports() checks the resource type if specified');
+ }
+
+ public function testLoadDoesNothingIfEmpty()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $collection = $loader->load('empty.yml');
+
+ $this->assertEquals(array(), $collection->all());
+ $this->assertEquals(array(new FileResource(realpath(__DIR__.'/../Fixtures/empty.yml'))), $collection->getResources());
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @dataProvider getPathsToInvalidFiles
+ */
+ public function testLoadThrowsExceptionWithInvalidFile($filePath)
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $loader->load($filePath);
+ }
+
+ public function getPathsToInvalidFiles()
+ {
+ return array(
+ array('nonvalid.yml'),
+ array('nonvalid2.yml'),
+ array('incomplete.yml'),
+ array('nonvalidkeys.yml'),
+ array('nonesense_resource_plus_path.yml'),
+ array('nonesense_type_without_resource.yml'),
+ array('bad_format.yml'),
+ );
+ }
+
+ public function testLoadSpecialRouteName()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('special_route_name.yml');
+ $route = $routeCollection->get('#$péß^a|');
+
+ $this->assertInstanceOf('Symfony\Component\Routing\Route', $route);
+ $this->assertSame('/true', $route->getPath());
+ }
+
+ public function testLoadWithRoute()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('validpattern.yml');
+ $route = $routeCollection->get('blog_show');
+
+ $this->assertInstanceOf('Symfony\Component\Routing\Route', $route);
+ $this->assertSame('/blog/{slug}', $route->getPath());
+ $this->assertSame('{locale}.example.com', $route->getHost());
+ $this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller'));
+ $this->assertSame('\w+', $route->getRequirement('locale'));
+ $this->assertSame('RouteCompiler', $route->getOption('compiler_class'));
+ $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods());
+ $this->assertEquals(array('https'), $route->getSchemes());
+ $this->assertEquals('context.getMethod() == "GET"', $route->getCondition());
+ }
+
+ public function testLoadWithResource()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
+ $routeCollection = $loader->load('validresource.yml');
+ $routes = $routeCollection->all();
+
+ $this->assertCount(2, $routes, 'Two routes are loaded');
+ $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
+
+ foreach ($routes as $route) {
+ $this->assertSame('/{foo}/blog/{slug}', $route->getPath());
+ $this->assertSame('123', $route->getDefault('foo'));
+ $this->assertSame('\d+', $route->getRequirement('foo'));
+ $this->assertSame('bar', $route->getOption('foo'));
+ $this->assertSame('', $route->getHost());
+ $this->assertSame('context.getMethod() == "POST"', $route->getCondition());
+ }
+ }
+
+ public function testLoadRouteWithControllerAttribute()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $routeCollection = $loader->load('routing.yml');
+
+ $route = $routeCollection->get('app_homepage');
+
+ $this->assertSame('AppBundle:Homepage:show', $route->getDefault('_controller'));
+ }
+
+ public function testLoadRouteWithoutControllerAttribute()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $routeCollection = $loader->load('routing.yml');
+
+ $route = $routeCollection->get('app_logout');
+
+ $this->assertNull($route->getDefault('_controller'));
+ }
+
+ public function testLoadRouteWithControllerSetInDefaults()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $routeCollection = $loader->load('routing.yml');
+
+ $route = $routeCollection->get('app_blog');
+
+ $this->assertSame('AppBundle:Blog:list', $route->getDefault('_controller'));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" key and the defaults key "_controller" for "app_blog"/
+ */
+ public function testOverrideControllerInDefaults()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $loader->load('override_defaults.yml');
+ }
+
+ /**
+ * @dataProvider provideFilesImportingRoutesWithControllers
+ */
+ public function testImportRouteWithController($file)
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $routeCollection = $loader->load($file);
+
+ $route = $routeCollection->get('app_homepage');
+ $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('app_blog');
+ $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('app_logout');
+ $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller'));
+ }
+
+ public function provideFilesImportingRoutesWithControllers()
+ {
+ yield array('import_controller.yml');
+ yield array('import__controller.yml');
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" key and the defaults key "_controller" for "_static"/
+ */
+ public function testImportWithOverriddenController()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
+ $loader->load('import_override_defaults.yml');
+ }
+
+ public function testImportRouteWithGlobMatchingSingleFile()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob')));
+ $routeCollection = $loader->load('import_single.yml');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+ }
+
+ public function testImportRouteWithGlobMatchingMultipleFiles()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob')));
+ $routeCollection = $loader->load('import_multiple.yml');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('baz_route');
+ $this->assertSame('AppBundle:Baz:view', $route->getDefault('_controller'));
+ }
+}