Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
c5b3dcde27 |
@ -144,7 +144,7 @@ class d3DicHandler implements d3DicHandlerInterface
|
||||
{
|
||||
startProfile(__METHOD__);
|
||||
|
||||
if ($this->d3UseCachedContainer()) {
|
||||
if ($this->d3UseCachedContainer() && $compileAndDump) {
|
||||
$container = $this->d3GetCacheContainer();
|
||||
} else {
|
||||
$container = $this->getContainerBuilder();
|
||||
@ -166,9 +166,9 @@ class d3DicHandler implements d3DicHandlerInterface
|
||||
{
|
||||
$config = $this->d3GetConfig();
|
||||
|
||||
return $config->isProductiveMode()
|
||||
// && !$config->getConfigParam('iDebug')
|
||||
&& $this->cacheFileExists();
|
||||
return // $config->isProductiveMode() &&
|
||||
// !$config->getConfigParam('iDebug') &&
|
||||
$this->cacheFileExists();
|
||||
}
|
||||
|
||||
public function getContainerBuilder(): ContainerBuilder
|
||||
|
@ -17,11 +17,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\DIContainerHandler\tests\unit\autoload;
|
||||
|
||||
use D3\DIContainerHandler\d3DicException;
|
||||
use D3\TestingTools\Development\CanAccessRestricted;
|
||||
use Exception;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
|
||||
class functions_oxDICTest extends TestCase
|
||||
{
|
||||
@ -37,7 +36,7 @@ class functions_oxDICTest extends TestCase
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
ContainerBuilder::class,
|
||||
Container::class,
|
||||
d3GetOxidDIC_withExceptions()
|
||||
);
|
||||
}
|
||||
@ -52,7 +51,7 @@ class functions_oxDICTest extends TestCase
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
ContainerBuilder::class,
|
||||
Container::class,
|
||||
d3GetOxidDIC()
|
||||
);
|
||||
}
|
||||
|
@ -59,25 +59,25 @@ class d3DicHandlerTest extends TestCase
|
||||
null
|
||||
);
|
||||
|
||||
$containerBuilder = $this->callMethod(
|
||||
$container = $this->callMethod(
|
||||
$sut,
|
||||
'getInstance'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
ContainerBuilder::class,
|
||||
$containerBuilder
|
||||
Container::class,
|
||||
$container
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
$containerBuilder,
|
||||
$container,
|
||||
$this->callMethod(
|
||||
$sut,
|
||||
'getInstance'
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertTrue($containerBuilder->isCompiled());
|
||||
$this->assertTrue($container->isCompiled());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,17 +90,17 @@ class d3DicHandlerTest extends TestCase
|
||||
$sut = new d3DicHandler();
|
||||
|
||||
// test new instance
|
||||
$containerBuilder = $this->callMethod(
|
||||
$container = $this->callMethod(
|
||||
$sut,
|
||||
'getUncompiledInstance'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
ContainerBuilder::class,
|
||||
$containerBuilder
|
||||
Container::class,
|
||||
$container
|
||||
);
|
||||
|
||||
$this->assertFalse($containerBuilder->isCompiled());
|
||||
$this->assertFalse($container->isCompiled());
|
||||
|
||||
// test if compiled instance is getting resetted
|
||||
$this->callMethod(
|
||||
@ -112,11 +112,11 @@ class d3DicHandlerTest extends TestCase
|
||||
'getInstance'
|
||||
);
|
||||
|
||||
$containerBuilder = $this->callMethod(
|
||||
$container = $this->callMethod(
|
||||
$sut,
|
||||
'getUncompiledInstance'
|
||||
);
|
||||
$this->assertFalse($containerBuilder->isCompiled());
|
||||
$this->assertFalse($container->isCompiled());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -420,7 +420,7 @@ class d3DicHandlerTest extends TestCase
|
||||
{
|
||||
yield "can't use cached container, do compile" => [false, true];
|
||||
yield "can't use cached container, don't compile" => [false, false];
|
||||
yield "use cached container" => [true, false];
|
||||
yield "use cached container" => [true, true];
|
||||
yield "can't use cached container, do compile, default" => [false, true, true];
|
||||
}
|
||||
|
||||
@ -463,7 +463,7 @@ class d3DicHandlerTest extends TestCase
|
||||
|
||||
public function canUseCachedContainerDataProvider(): Generator
|
||||
{
|
||||
yield "not productive" => [false, 0, true, false];
|
||||
yield "not productive" => [false, 0, true, true];
|
||||
yield 'is debug' => [true, 1, true, true];
|
||||
yield 'no cache file' => [true, 0, false, false];
|
||||
yield 'can use cached' => [true, 0, true, true];
|
||||
|
Loading…
x
Reference in New Issue
Block a user