fix tests

This commit is contained in:
Daniel Seifert 2024-02-19 08:36:41 +01:00
parent afdb6ff4c1
commit 1b2f3e0d0b
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
9 changed files with 15 additions and 43 deletions

View File

@ -3,11 +3,11 @@
# 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
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.
@ -31,7 +31,7 @@ Then empty the TMP folder.
## Changelog
See [CHANGELOG](CHANGELOG.md) for further informations.
See [CHANGELOG](CHANGELOG.md) for further information.
## Contributing

View File

@ -18,7 +18,6 @@ use D3\DIContainerHandler\d3DicHandler;
use Symfony\Component\DependencyInjection\Container;
/**
* @return Container
* @throws d3DicException
*/
function d3GetOxidDIC(): Container

View File

@ -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",
"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"
}

View File

@ -19,11 +19,8 @@ use Exception;
class d3DicException extends Exception
{
/**
* @param Exception $previous
*/
public function __construct(Exception $previous)
{
parent::__construct($previous->getMessage(), $previous->getCode(), $previous);
}
}
}

View File

@ -36,7 +36,6 @@ class d3DicHandler implements d3DicHandlerInterface
/**
* get instance
* @return Container
* @throws d3DicException
*/
public static function getInstance(): Container
@ -63,7 +62,6 @@ class d3DicHandler implements d3DicHandlerInterface
/**
* get instance
* @return Container
* @throws d3DicException
*/
public static function getUncompiledInstance(): Container
@ -120,8 +118,6 @@ class d3DicHandler implements d3DicHandlerInterface
}
/**
* @param ContainerBuilder $container
* @return void
* @throws Exception
*/
public function loadFiles(ContainerBuilder $container): void
@ -148,8 +144,6 @@ class d3DicHandler implements d3DicHandlerInterface
}
/**
* @param bool $compileAndDump
* @return Container
* @throws Exception
*/
public function buildContainer(bool $compileAndDump = true): Container
@ -160,10 +154,10 @@ class d3DicHandler implements d3DicHandlerInterface
$config = $this->d3GetConfig();
if ($config->isProductiveMode()
&& ! $config->getConfigParam('iDebug')
&& $this->isNotInTest()
&& $this->cacheFileExists()
if ($this->isNotInTest() &&
$config->isProductiveMode() &&
!$config->getConfigParam('iDebug') &&
$this->cacheFileExists()
) {
$container = $this->d3GetCacheContainer();
} else {
@ -192,17 +186,13 @@ class d3DicHandler implements d3DicHandlerInterface
return oxNew(ContainerBuilder::class);
}
/**
* clone
*/
public function __clone()
{
/** keep clear */
}
/**
* constructor
*/
public function __construct()
{
/** keep clear */
}
}

View File

@ -16,7 +16,6 @@ declare(strict_types=1);
namespace D3\DIContainerHandler;
use Assert\Assert;
use Assert\InvalidArgumentException;
class definitionFileContainer
{
@ -32,6 +31,7 @@ class definitionFileContainer
public function __construct()
{
/** keep clear */
}
public function addDefinitions(string $definitionFile, string $type): void

View File

@ -2,27 +2,10 @@
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\DeadCode\Rector\Assign\RemoveDoubleAssignRector;
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
use Rector\Set\ValueObject\LevelSetList;
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 {
$rectorConfig->paths([

View File

@ -30,6 +30,8 @@ class functions_oxDICTest extends TestCase
*/
public function d3GetOxidDICTest(): void
{
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
$this->assertInstanceOf(
ContainerBuilder::class,
d3GetOxidDIC()

View File

@ -35,7 +35,7 @@ class d3DicUtilitiesTest extends TestCase
* @covers \D3\DIContainerHandler\d3DicUtilities::getServiceId
* @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);