Dependency updates and update version number

This commit is contained in:
Kode
2018-06-13 19:35:28 +01:00
parent 18ec208381
commit e3ec7de23a
1261 changed files with 45582 additions and 29687 deletions

View File

@@ -191,9 +191,9 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
);
$this->reader
->expects($this->exactly(2))
->method('getClassAnnotation')
->will($this->returnValue($this->getAnnotatedRoute($classRouteData)))
->expects($this->exactly(1))
->method('getClassAnnotations')
->will($this->returnValue(array($this->getAnnotatedRoute($classRouteData))))
;
$this->reader
->expects($this->once())
@@ -205,8 +205,49 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
$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');
$this->assertEquals($classRouteData['schemes'], $route->getSchemes(), '->load preserves class route schemes');
$this->assertEquals($classRouteData['methods'], $route->getMethods(), '->load preserves class route methods');
}
public function testInvokableClassMultipleRouteLoad()
{
$classRouteData1 = array(
'name' => 'route1',
'path' => '/1',
'schemes' => array('https'),
'methods' => array('GET'),
);
$classRouteData2 = array(
'name' => 'route2',
'path' => '/2',
'schemes' => array('https'),
'methods' => array('GET'),
);
$this->reader
->expects($this->exactly(1))
->method('getClassAnnotations')
->will($this->returnValue(array($this->getAnnotatedRoute($classRouteData1), $this->getAnnotatedRoute($classRouteData2))))
;
$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($classRouteData1['name']);
$this->assertSame($classRouteData1['path'], $route->getPath(), '->load preserves class route path');
$this->assertEquals($classRouteData1['schemes'], $route->getSchemes(), '->load preserves class route schemes');
$this->assertEquals($classRouteData1['methods'], $route->getMethods(), '->load preserves class route methods');
$route = $routeCollection->get($classRouteData2['name']);
$this->assertSame($classRouteData2['path'], $route->getPath(), '->load preserves class route path');
$this->assertEquals($classRouteData2['schemes'], $route->getSchemes(), '->load preserves class route schemes');
$this->assertEquals($classRouteData2['methods'], $route->getMethods(), '->load preserves class route methods');
}
public function testInvokableClassWithMethodRouteLoad()

View File

@@ -29,7 +29,7 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
public function testLoad()
{
$this->reader->expects($this->exactly(4))->method('getClassAnnotation');
$this->reader->expects($this->exactly(3))->method('getClassAnnotation');
$this->reader
->expects($this->any())
@@ -37,6 +37,12 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
->will($this->returnValue(array()))
;
$this->reader
->expects($this->any())
->method('getClassAnnotations')
->will($this->returnValue(array()))
;
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
}
@@ -45,7 +51,6 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
$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',
));
@@ -55,6 +60,12 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
->will($this->returnValue(array()))
;
$this->reader
->expects($this->any())
->method('getClassAnnotations')
->will($this->returnValue(array()))
;
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
}

View File

@@ -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();
}
}

View File

@@ -117,4 +117,17 @@ class PhpFileLoaderTest extends TestCase
$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'));
}
}

View File

@@ -361,4 +361,25 @@ class XmlFileLoaderTest extends TestCase
$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'));
}
}

View File

@@ -182,4 +182,25 @@ class YamlFileLoaderTest extends TestCase
$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'));
}
}