ensure that an uncompiled instance isn't changed by a compiled one
This commit is contained in:
bovenliggende
2408572bae
commit
b7cc4d70ba
@ -50,6 +50,7 @@ class d3DicHandler implements d3DicHandlerInterface
|
||||
*/
|
||||
public static function getUncompiledInstance(): Container
|
||||
{
|
||||
if (self::$_instance !== null && self::$_instance->isCompiled()) {self::removeInstance();}
|
||||
return oxNew(d3DicHandler::class)->createInstance(false);
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,7 @@ class d3DicHandlerTest extends TestCase
|
||||
{
|
||||
$sut = new d3DicHandler();
|
||||
|
||||
// test new instance
|
||||
$containerBuilder = $this->callMethod(
|
||||
$sut,
|
||||
'getUncompiledInstance'
|
||||
@ -100,6 +101,22 @@ class d3DicHandlerTest extends TestCase
|
||||
);
|
||||
|
||||
$this->assertFalse($containerBuilder->isCompiled());
|
||||
|
||||
// test if compiled instance is getting resetted
|
||||
$this->callMethod(
|
||||
$sut,
|
||||
'removeInstance'
|
||||
);
|
||||
$this->callMethod(
|
||||
$sut,
|
||||
'getInstance'
|
||||
);
|
||||
|
||||
$containerBuilder = $this->callMethod(
|
||||
$sut,
|
||||
'getUncompiledInstance'
|
||||
);
|
||||
$this->assertFalse($containerBuilder->isCompiled());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user