8000 fix and add tests · symfony/symfony@897a0fe · GitHub
[go: up one dir, main page]

Skip to content

Commit 897a0fe

Browse files
committed
fix and add tests
1 parent f6b7e21 commit 897a0fe

File tree

6 files changed

+32
-0
lines changed

6 files changed

+32
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<xsd:attribute name="secret" type="xsd:string" />
3939
<xsd:attribute name="default-locale" type="xsd:string" />
4040
<xsd:attribute name="test" type="xsd:boolean" />
41+
<xsd:attribute name="reset-services" type="xsd:boolean" />
4142
</xsd:complexType>
4243

4344
<xsd:complexType name="form">

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
352352
),
353353
),
354354
),
355+
'reset_services' => false,
355356
);
356357
}
357358
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', array(
4+
'reset_services' => true,
5+
));
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config reset-services="true" />
10+
</container>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
framework:
2+
reset_services: true

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
3333
use Symfony\Component\DependencyInjection\Reference;
3434
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
35+
use Symfony\Component\HttpKernel\EventListener\ServiceResetListener;
3536
use Symfony\Component\PropertyAccess\PropertyAccessor;
3637
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
3738
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
@@ -998,6 +999,18 @@ public function testCachePoolServices()
998999
$this->assertCachePoolServiceDefinitionIsCreated($container, 'cache.def', 'cache.app', 11);
9991000
}
10001001

1002+
public function testRemovesServiceResetListenerDefWhenOptionSetToFalse()
1003+
{
1004+
$container = $this->createContainerFromFile('default_config');
1005+
$this->assertFalse($container->hasDefinition(ServiceResetListener::class));
1006+
}
1007+
1008+
public function testDoesNotRemoveServiceResetListenerDefWhenOptionSetToTrue()
1009+
{
1010+
$container = $this->createContainerFromFile('reset_services');
1011+
$this->assertTrue($container->hasDefinition(ServiceResetListener::class));
1012+
}
1013+
10011014
protected function createContainer(array $data = array())
10021015
{
10031016
return new ContainerBuilder(new ParameterBag(array_merge(array(

0 commit comments

Comments
 (0)
0