fix tests
This commit is contained in:
parent
afdb6ff4c1
commit
1b2f3e0d0b
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
# Dependency Injection Container handler for OXID eShop
|
# Dependency Injection Container handler for OXID eShop
|
||||||
|
|
||||||
Enables the simple use of a class container outside of the OXID DI Services.
|
Enables the simple use of a class container outside the OXID DI Services.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
This package requires an Composer installed OXID eShop as defined in [composer.json](composer.json).
|
This package requires a Composer installed OXID eShop as defined in [composer.json](composer.json).
|
||||||
|
|
||||||
Open a command line interface and navigate to the shop root directory (parent of source and vendor). Execute the following command. Adapt the paths to your environment.
|
Open a command line interface and navigate to the shop root directory (parent of source and vendor). Execute the following command. Adapt the paths to your environment.
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ Then empty the TMP folder.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
See [CHANGELOG](CHANGELOG.md) for further informations.
|
See [CHANGELOG](CHANGELOG.md) for further information.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ use D3\DIContainerHandler\d3DicHandler;
|
|||||||
use Symfony\Component\DependencyInjection\Container;
|
use Symfony\Component\DependencyInjection\Container;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Container
|
|
||||||
* @throws d3DicException
|
* @throws d3DicException
|
||||||
*/
|
*/
|
||||||
function d3GetOxidDIC(): Container
|
function d3GetOxidDIC(): Container
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
"phpstan-report": "./vendor/bin/phpstan --configuration=vendor/d3/ordermanager/phpstan.neon analyse --error-format=json > vendor/d3/ordermanager/tests/phpstan.report.json",
|
"phpstan-report": "./vendor/bin/phpstan --configuration=vendor/d3/ordermanager/phpstan.neon analyse --error-format=json > vendor/d3/ordermanager/tests/phpstan.report.json",
|
||||||
|
|
||||||
"phpunit": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --bootstrap=source/bootstrap.php --config=vendor/d3/oxid-dic-handler/tests/",
|
"phpunit": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --bootstrap=source/bootstrap.php --config=vendor/d3/oxid-dic-handler/tests/",
|
||||||
|
"phpunit-coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text --bootstrap=source/bootstrap.php --config=vendor/d3/oxid-dic-handler/tests/ --coverage-html=vendor/d3/oxid-dic-handler/tests/result/coverage",
|
||||||
|
|
||||||
"rector": "./vendor/bin/rector process --dry-run --config ./vendor/d3/oxid-dic-handler/rector.php"
|
"rector": "./vendor/bin/rector process --dry-run --config ./vendor/d3/oxid-dic-handler/rector.php"
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,8 @@ use Exception;
|
|||||||
|
|
||||||
class d3DicException extends Exception
|
class d3DicException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Exception $previous
|
|
||||||
*/
|
|
||||||
public function __construct(Exception $previous)
|
public function __construct(Exception $previous)
|
||||||
{
|
{
|
||||||
parent::__construct($previous->getMessage(), $previous->getCode(), $previous);
|
parent::__construct($previous->getMessage(), $previous->getCode(), $previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* get instance
|
* get instance
|
||||||
* @return Container
|
|
||||||
* @throws d3DicException
|
* @throws d3DicException
|
||||||
*/
|
*/
|
||||||
public static function getInstance(): Container
|
public static function getInstance(): Container
|
||||||
@ -63,7 +62,6 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* get instance
|
* get instance
|
||||||
* @return Container
|
|
||||||
* @throws d3DicException
|
* @throws d3DicException
|
||||||
*/
|
*/
|
||||||
public static function getUncompiledInstance(): Container
|
public static function getUncompiledInstance(): Container
|
||||||
@ -120,8 +118,6 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerBuilder $container
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function loadFiles(ContainerBuilder $container): void
|
public function loadFiles(ContainerBuilder $container): void
|
||||||
@ -148,8 +144,6 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $compileAndDump
|
|
||||||
* @return Container
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function buildContainer(bool $compileAndDump = true): Container
|
public function buildContainer(bool $compileAndDump = true): Container
|
||||||
@ -160,10 +154,10 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
|
|
||||||
$config = $this->d3GetConfig();
|
$config = $this->d3GetConfig();
|
||||||
|
|
||||||
if ($config->isProductiveMode()
|
if ($this->isNotInTest() &&
|
||||||
&& ! $config->getConfigParam('iDebug')
|
$config->isProductiveMode() &&
|
||||||
&& $this->isNotInTest()
|
!$config->getConfigParam('iDebug') &&
|
||||||
&& $this->cacheFileExists()
|
$this->cacheFileExists()
|
||||||
) {
|
) {
|
||||||
$container = $this->d3GetCacheContainer();
|
$container = $this->d3GetCacheContainer();
|
||||||
} else {
|
} else {
|
||||||
@ -192,17 +186,13 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
return oxNew(ContainerBuilder::class);
|
return oxNew(ContainerBuilder::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clone
|
|
||||||
*/
|
|
||||||
public function __clone()
|
public function __clone()
|
||||||
{
|
{
|
||||||
|
/** keep clear */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* constructor
|
|
||||||
*/
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
/** keep clear */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ declare(strict_types=1);
|
|||||||
namespace D3\DIContainerHandler;
|
namespace D3\DIContainerHandler;
|
||||||
|
|
||||||
use Assert\Assert;
|
use Assert\Assert;
|
||||||
use Assert\InvalidArgumentException;
|
|
||||||
|
|
||||||
class definitionFileContainer
|
class definitionFileContainer
|
||||||
{
|
{
|
||||||
@ -32,6 +31,7 @@ class definitionFileContainer
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
/** keep clear */
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addDefinitions(string $definitionFile, string $type): void
|
public function addDefinitions(string $definitionFile, string $type): void
|
||||||
|
17
rector.php
17
rector.php
@ -2,27 +2,10 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
|
|
||||||
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
|
|
||||||
use Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector;
|
|
||||||
use Rector\Config\RectorConfig;
|
use Rector\Config\RectorConfig;
|
||||||
use Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector;
|
|
||||||
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
|
|
||||||
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
|
|
||||||
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
|
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
|
||||||
use Rector\Set\ValueObject\LevelSetList;
|
use Rector\Set\ValueObject\LevelSetList;
|
||||||
use Rector\Set\ValueObject\SetList;
|
use Rector\Set\ValueObject\SetList;
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromStrictScalarReturnsRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnUnionTypeRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector;
|
|
||||||
use Rector\TypeDeclaration\Rector\ClassMethod\StrictStringParamConcatRector;
|
|
||||||
|
|
||||||
return static function (RectorConfig $rectorConfig): void {
|
return static function (RectorConfig $rectorConfig): void {
|
||||||
$rectorConfig->paths([
|
$rectorConfig->paths([
|
||||||
|
@ -30,6 +30,8 @@ class functions_oxDICTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function d3GetOxidDICTest(): void
|
public function d3GetOxidDICTest(): void
|
||||||
{
|
{
|
||||||
|
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
|
||||||
|
|
||||||
$this->assertInstanceOf(
|
$this->assertInstanceOf(
|
||||||
ContainerBuilder::class,
|
ContainerBuilder::class,
|
||||||
d3GetOxidDIC()
|
d3GetOxidDIC()
|
||||||
|
@ -35,7 +35,7 @@ class d3DicUtilitiesTest extends TestCase
|
|||||||
* @covers \D3\DIContainerHandler\d3DicUtilities::getServiceId
|
* @covers \D3\DIContainerHandler\d3DicUtilities::getServiceId
|
||||||
* @dataProvider getServiceIdTestDataProvider
|
* @dataProvider getServiceIdTestDataProvider
|
||||||
*/
|
*/
|
||||||
public function getServiceIdTest(string $className, string $additional = null, string $expected): void
|
public function getServiceIdTest(string $className, ?string $additional, string $expected): void
|
||||||
{
|
{
|
||||||
$sut = oxNew(d3DicUtilities::class);
|
$sut = oxNew(d3DicUtilities::class);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user