Issue #2940956 by alexpott: Properly disable resource tracking in the ContainerBuilder
parent
3dad711909
commit
33e0ba310d
|
@ -27,8 +27,8 @@ class ContainerBuilder extends SymfonyContainerBuilder {
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBagInterface $parameterBag = NULL) {
|
public function __construct(ParameterBagInterface $parameterBag = NULL) {
|
||||||
$this->setResourceTracking(FALSE);
|
|
||||||
parent::__construct($parameterBag);
|
parent::__construct($parameterBag);
|
||||||
|
$this->setResourceTracking(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -118,4 +118,27 @@ class ContainerBuilderTest extends UnitTestCase {
|
||||||
serialize($container);
|
serialize($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests constructor and resource tracking disabling.
|
||||||
|
*
|
||||||
|
* This test runs in a separate process to ensure the aliased class does not
|
||||||
|
* affect any other tests.
|
||||||
|
*
|
||||||
|
* @runInSeparateProcess
|
||||||
|
* @preserveGlobalState disabled
|
||||||
|
*/
|
||||||
|
public function testConstructor() {
|
||||||
|
class_alias(testInterface::class, 'Symfony\Component\Config\Resource\ResourceInterface');
|
||||||
|
$container = new ContainerBuilder();
|
||||||
|
$this->assertFalse($container->isTrackingResources());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test interface for testing ContainerBuilder::__construct().
|
||||||
|
*
|
||||||
|
* @see \Drupal\Tests\Core\DependencyInjection\ContainerBuilderTest::testConstructor()
|
||||||
|
*/
|
||||||
|
interface testInterface {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue