Update composer dependencies

This commit is contained in:
Chris
2019-06-11 12:29:32 +01:00
parent 7d6df3843b
commit 1f608b1c21
1835 changed files with 74500 additions and 27482 deletions

View File

@@ -0,0 +1,117 @@
<?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\HttpKernel\Tests\Controller\ArgumentResolver;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\NotTaggedControllerValueResolver;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
class NotTaggedControllerValueResolverTest extends TestCase
{
public function testDoSupportWhenControllerDoNotExists()
{
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
$request = $this->requestWithAttributes(['_controller' => 'my_controller']);
$this->assertTrue($resolver->supports($request, $argument));
}
public function testDoNotSupportWhenControllerExists()
{
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([
'App\\Controller\\Mine::method' => function () {
return new ServiceLocator([
'dummy' => function () {
return new \stdClass();
},
]);
},
]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
$request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::method']);
$this->assertFalse($resolver->supports($request, $argument));
}
public function testDoNotSupportEmptyController()
{
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
$request = $this->requestWithAttributes(['_controller' => '']);
$this->assertFalse($resolver->supports($request, $argument));
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
* @expectedExceptionMessage Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?
*/
public function testController()
{
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
$request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::method']);
$this->assertTrue($resolver->supports($request, $argument));
$resolver->resolve($request, $argument);
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
* @expectedExceptionMessage Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?
*/
public function testControllerWithATrailingBackSlash()
{
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
$request = $this->requestWithAttributes(['_controller' => '\\App\\Controller\\Mine::method']);
$this->assertTrue($resolver->supports($request, $argument));
$resolver->resolve($request, $argument);
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
* @expectedExceptionMessage Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?
*/
public function testControllerWithMethodNameStartUppercase()
{
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
$request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::Method']);
$this->assertTrue($resolver->supports($request, $argument));
$resolver->resolve($request, $argument);
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
* @expectedExceptionMessage Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?
*/
public function testControllerNameIsAnArray()
{
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
$request = $this->requestWithAttributes(['_controller' => ['App\\Controller\\Mine', 'method']]);
$this->assertTrue($resolver->supports($request, $argument));
$resolver->resolve($request, $argument);
}
private function requestWithAttributes(array $attributes)
{
$request = Request::create('/');
foreach ($attributes as $name => $value) {
$request->attributes->set($name, $value);
}
return $request;
}
}

View File

@@ -23,86 +23,86 @@ class ServiceValueResolverTest extends TestCase
{
public function testDoNotSupportWhenControllerDoNotExists()
{
$resolver = new ServiceValueResolver(new ServiceLocator(array()));
$resolver = new ServiceValueResolver(new ServiceLocator([]));
$argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null);
$request = $this->requestWithAttributes(array('_controller' => 'my_controller'));
$request = $this->requestWithAttributes(['_controller' => 'my_controller']);
$this->assertFalse($resolver->supports($request, $argument));
}
public function testExistingController()
{
$resolver = new ServiceValueResolver(new ServiceLocator(array(
$resolver = new ServiceValueResolver(new ServiceLocator([
'App\\Controller\\Mine::method' => function () {
return new ServiceLocator(array(
return new ServiceLocator([
'dummy' => function () {
return new DummyService();
},
));
]);
},
)));
]));
$request = $this->requestWithAttributes(array('_controller' => 'App\\Controller\\Mine::method'));
$request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::method']);
$argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null);
$this->assertTrue($resolver->supports($request, $argument));
$this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument));
$this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument));
}
public function testExistingControllerWithATrailingBackSlash()
{
$resolver = new ServiceValueResolver(new ServiceLocator(array(
$resolver = new ServiceValueResolver(new ServiceLocator([
'App\\Controller\\Mine::method' => function () {
return new ServiceLocator(array(
return new ServiceLocator([
'dummy' => function () {
return new DummyService();
},
));
]);
},
)));
]));
$request = $this->requestWithAttributes(array('_controller' => '\\App\\Controller\\Mine::method'));
$request = $this->requestWithAttributes(['_controller' => '\\App\\Controller\\Mine::method']);
$argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null);
$this->assertTrue($resolver->supports($request, $argument));
$this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument));
$this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument));
}
public function testExistingControllerWithMethodNameStartUppercase()
{
$resolver = new ServiceValueResolver(new ServiceLocator(array(
$resolver = new ServiceValueResolver(new ServiceLocator([
'App\\Controller\\Mine::method' => function () {
return new ServiceLocator(array(
return new ServiceLocator([
'dummy' => function () {
return new DummyService();
},
));
]);
},
)));
$request = $this->requestWithAttributes(array('_controller' => 'App\\Controller\\Mine::Method'));
]));
$request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::Method']);
$argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null);
$this->assertTrue($resolver->supports($request, $argument));
$this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument));
$this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument));
}
public function testControllerNameIsAnArray()
{
$resolver = new ServiceValueResolver(new ServiceLocator(array(
$resolver = new ServiceValueResolver(new ServiceLocator([
'App\\Controller\\Mine::method' => function () {
return new ServiceLocator(array(
return new ServiceLocator([
'dummy' => function () {
return new DummyService();
},
));
]);
},
)));
]));
$request = $this->requestWithAttributes(array('_controller' => array('App\\Controller\\Mine', 'method')));
$request = $this->requestWithAttributes(['_controller' => ['App\\Controller\\Mine', 'method']]);
$argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null);
$this->assertTrue($resolver->supports($request, $argument));
$this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument));
$this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument));
}
/**
@@ -119,7 +119,7 @@ class ServiceValueResolverTest extends TestCase
$container->compile();
$request = $this->requestWithAttributes(array('_controller' => array(DummyController::class, 'index')));
$request = $this->requestWithAttributes(['_controller' => [DummyController::class, 'index']]);
$argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null);
$container->get('argument_resolver.service')->resolve($request, $argument)->current();
}
@@ -137,7 +137,7 @@ class ServiceValueResolverTest extends TestCase
private function assertYieldEquals(array $expected, \Generator $generator)
{
$args = array();
$args = [];
foreach ($generator as $arg) {
$args[] = $arg;
}