Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
78
vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php
vendored
Normal file
78
vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\ClearableService;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService;
|
||||
|
||||
class ResettableServicePassTest extends TestCase
|
||||
{
|
||||
public function testCompilerPass()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('one', ResettableService::class)
|
||||
->setPublic(true)
|
||||
->addTag('kernel.reset', array('method' => 'reset'));
|
||||
$container->register('two', ClearableService::class)
|
||||
->setPublic(true)
|
||||
->addTag('kernel.reset', array('method' => 'clear'));
|
||||
|
||||
$container->register('services_resetter', ServicesResetter::class)
|
||||
->setPublic(true)
|
||||
->setArguments(array(null, array()));
|
||||
$container->addCompilerPass(new ResettableServicePass());
|
||||
|
||||
$container->compile();
|
||||
|
||||
$definition = $container->getDefinition('services_resetter');
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
new IteratorArgument(array(
|
||||
'one' => new Reference('one', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE),
|
||||
'two' => new Reference('two', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE),
|
||||
)),
|
||||
array(
|
||||
'one' => 'reset',
|
||||
'two' => 'clear',
|
||||
),
|
||||
),
|
||||
$definition->getArguments()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Tag kernel.reset requires the "method" attribute to be set.
|
||||
*/
|
||||
public function testMissingMethod()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register(ResettableService::class)
|
||||
->addTag('kernel.reset');
|
||||
$container->register('services_resetter', ServicesResetter::class)
|
||||
->setArguments(array(null, array()));
|
||||
$container->addCompilerPass(new ResettableServicePass());
|
||||
|
||||
$container->compile();
|
||||
}
|
||||
|
||||
public function testCompilerPassWithoutResetters()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('services_resetter', ServicesResetter::class)
|
||||
->setArguments(array(null, array()));
|
||||
$container->addCompilerPass(new ResettableServicePass());
|
||||
|
||||
$container->compile();
|
||||
|
||||
$this->assertFalse($container->has('services_resetter'));
|
||||
}
|
||||
}
|
Reference in a new issue