Compare commits
No commits in common. "main" and "2.1.0.0" have entirely different histories.
@ -1,34 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
$finder = PhpCsFixer\Finder::create()
|
$finder = PhpCsFixer\Finder::create()
|
||||||
->in(__DIR__)
|
->in(__DIR__)
|
||||||
;
|
;
|
||||||
|
|
||||||
$header = <<<EOF
|
|
||||||
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
|
||||||
|
|
||||||
For the full copyright and license information, please view
|
|
||||||
the LICENSE file that was distributed with this source code.
|
|
||||||
|
|
||||||
https://www.d3data.de
|
|
||||||
|
|
||||||
@copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
||||||
@author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
||||||
@link https://www.oxidmodule.com
|
|
||||||
EOF;
|
|
||||||
|
|
||||||
$config = new PhpCsFixer\Config();
|
$config = new PhpCsFixer\Config();
|
||||||
return $config->setRules([
|
return $config->setRules([
|
||||||
'@PHP80Migration' => true,
|
'@PHP80Migration' => true,
|
||||||
'@PSR12' => true,
|
'@PSR12' => true
|
||||||
'header_comment' => [
|
|
||||||
'comment_type' => 'PHPDoc',
|
|
||||||
'header' => $header,
|
|
||||||
'location' => 'after_open',
|
|
||||||
'separate' => 'both',
|
|
||||||
],
|
|
||||||
])
|
])
|
||||||
->setFinder($finder)
|
->setFinder($finder)
|
||||||
;
|
;
|
@ -4,11 +4,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased](https://git.d3data.de/D3Public/DIContainer/compare/2.1.1.0...rel_2.x)
|
## [Unreleased](https://git.d3data.de/D3Public/DIContainer/compare/2.1.0.0...rel_2.x)
|
||||||
|
|
||||||
## [2.1.1.0](https://git.d3data.de/D3Public/DIContainer/compare/2.1.0.0...2.1.1.0) - 2024-08-30
|
|
||||||
### Changed
|
|
||||||
- ensure that an uncompiled instance weren't changed by a compiled one
|
|
||||||
|
|
||||||
## [2.1.0.0](https://git.d3data.de/D3Public/DIContainer/compare/2.0.0.0...2.1.0.0) - 2024-06-05
|
## [2.1.0.0](https://git.d3data.de/D3Public/DIContainer/compare/2.0.0.0...2.1.0.0) - 2024-06-05
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
"friendsofphp/php-cs-fixer": "~3.13.0",
|
"friendsofphp/php-cs-fixer": "~3.13.0",
|
||||||
"phpstan/phpstan": "^1.10",
|
"phpstan/phpstan": "^1.10",
|
||||||
"rector/rector": "^0.18.13",
|
"rector/rector": "^0.18.13",
|
||||||
"mikey179/vfsstream": "^1.6.8",
|
"mikey179/vfsstream": "^1.6.8"
|
||||||
"infection/infection": "^0.29.5"
|
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@ -42,22 +41,14 @@
|
|||||||
"autoload/functions_oxDIC.php"
|
"autoload/functions_oxDIC.php"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
|
||||||
"psr-4": {
|
|
||||||
"D3\\DIContainerHandler\\tests": "./tests"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"php-cs-fixer": "./vendor/bin/php-cs-fixer fix --config=vendor/d3/oxid-dic-handler/.php-cs-fixer.php",
|
"php-cs-fixer": "./vendor/bin/php-cs-fixer fix --config=vendor/d3/oxid-dic-handler/.php-cs-fixer.php",
|
||||||
|
|
||||||
"phpstan": "./vendor/bin/phpstan --configuration=vendor/d3/oxid-dic-handler/phpstan.neon analyse",
|
"phpstan": "./vendor/bin/phpstan --configuration=vendor/d3/oxid-dic-handler/phpstan.neon analyse",
|
||||||
"phpstan-report": "./vendor/bin/phpstan --configuration=vendor/d3/ordermanager/phpstan.neon analyse --error-format=json > reports/phpstan/oxid-dic-handler/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 --config=vendor/d3/oxid-dic-handler/tests/ --no-coverage",
|
"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 --config=vendor/d3/oxid-dic-handler/tests/ --coverage-html=reports/phpunit/oxid-dic-handler",
|
"phpunit-coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --bootstrap=source/bootstrap.php --config=vendor/d3/oxid-dic-handler/tests/ --coverage-html=vendor/d3/oxid-dic-handler/tests/result/coverage",
|
||||||
"phpunit-path-coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --config=vendor/d3/oxid-dic-handler/tests/ --coverage-html=reports/phpunit/oxid-dic-handler --path-coverage",
|
|
||||||
|
|
||||||
"infection": "./vendor/bin/infection --configuration=vendor/d3/oxid-dic-handler/infection.json5",
|
|
||||||
|
|
||||||
"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"
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -21,6 +19,7 @@ use d3DIContainerCache;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use OxidEsales\Eshop\Core\Config;
|
use OxidEsales\Eshop\Core\Config;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use OxidEsales\Facts\Config\ConfigFile;
|
||||||
use Symfony\Component\Config\FileLocator;
|
use Symfony\Component\Config\FileLocator;
|
||||||
use Symfony\Component\DependencyInjection\Container;
|
use Symfony\Component\DependencyInjection\Container;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
@ -50,7 +49,6 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
*/
|
*/
|
||||||
public static function getUncompiledInstance(): Container
|
public static function getUncompiledInstance(): Container
|
||||||
{
|
{
|
||||||
if (self::$_instance !== null && self::$_instance->isCompiled()) {self::removeInstance();}
|
|
||||||
return oxNew(d3DicHandler::class)->createInstance(false);
|
return oxNew(d3DicHandler::class)->createInstance(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -40,8 +38,8 @@ class d3DicUtilities
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getVendorDir($current = __FILE__): string
|
public static function getVendorDir(): string
|
||||||
{
|
{
|
||||||
return dirname($current, 3). '/';
|
return rtrim(dirname(__FILE__, 3), '/') . '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -39,7 +37,7 @@ class definitionFileContainer
|
|||||||
public function addDefinitions(string $definitionFile, string $type): void
|
public function addDefinitions(string $definitionFile, string $type): void
|
||||||
{
|
{
|
||||||
Assert::that($type)->inArray($this->allowedTypes, 'invalid definition file type');
|
Assert::that($type)->inArray($this->allowedTypes, 'invalid definition file type');
|
||||||
Assert::that(dirname(__FILE__, 3).'/'.$definitionFile)->file('invalid definition file');
|
Assert::that(rtrim(dirname(__FILE__, 3).'/').$definitionFile)->file('invalid definition file');
|
||||||
|
|
||||||
$this->definitionFiles[$type][md5($definitionFile)] = $definitionFile;
|
$this->definitionFiles[$type][md5($definitionFile)] = $definitionFile;
|
||||||
}
|
}
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
"source": {
|
|
||||||
"directories": [
|
|
||||||
"vendor/d3/oxid-dic-handler"
|
|
||||||
],
|
|
||||||
"excludes": [
|
|
||||||
".php-cs-fixer.php",
|
|
||||||
"rector.php",
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"timeout": 60,
|
|
||||||
"logs": {
|
|
||||||
"text": "../../../reports/infection/d3DICHandler/infection.log",
|
|
||||||
"html": "../../../reports/infection/d3DICHandler/infection.html",
|
|
||||||
"summary": "../../../reports/infection/d3DICHandler/summary.log",
|
|
||||||
"json": "../../../reports/infection/d3DICHandler/infection-log.json",
|
|
||||||
"perMutator": "../../../reports/infection/d3DICHandler/per-mutator.md",
|
|
||||||
"summaryJson": "../../../reports/infection/d3DICHandler/summary.json"
|
|
||||||
},
|
|
||||||
"tmpDir": "./infection/tmp",
|
|
||||||
"phpUnit": {
|
|
||||||
"configDir": "tests"
|
|
||||||
},
|
|
||||||
"mutators": {
|
|
||||||
"@default": true,
|
|
||||||
"@function_signature": false,
|
|
||||||
"global-ignoreSourceCodeByRegex": [
|
|
||||||
".*\\sstartProfile\\(.*",
|
|
||||||
".*\\sstopProfile\\(.*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"testFramework":"phpunit",
|
|
||||||
"bootstrap":"source/bootstrap.php"
|
|
||||||
}
|
|
13
rector.php
13
rector.php
@ -1,18 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
|
||||||
* https://www.d3data.de
|
|
||||||
*
|
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
||||||
* @link https://www.oxidmodule.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Rector\Config\RectorConfig;
|
use Rector\Config\RectorConfig;
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
backupGlobals="true"
|
backupGlobals="true"
|
||||||
bootstrap="../../../../source/bootstrap.php"
|
|
||||||
colors="false"
|
|
||||||
backupStaticAttributes="false"
|
backupStaticAttributes="false"
|
||||||
|
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||||
|
colors="false"
|
||||||
convertErrorsToExceptions="true"
|
convertErrorsToExceptions="true"
|
||||||
convertNoticesToExceptions="false"
|
convertNoticesToExceptions="false"
|
||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
@ -13,14 +13,8 @@
|
|||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
stopOnIncomplete="false"
|
stopOnIncomplete="false"
|
||||||
stopOnSkipped="false"
|
stopOnSkipped="false"
|
||||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
|
||||||
verbose="false"
|
verbose="false"
|
||||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||||
<testsuites>
|
|
||||||
<testsuite name="Unit">
|
|
||||||
<directory>unit/</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
|
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
|
||||||
<include>
|
<include>
|
||||||
<directory suffix=".php">../</directory>
|
<directory suffix=".php">../</directory>
|
||||||
@ -31,4 +25,9 @@
|
|||||||
<file>../.php-cs-fixer.php</file>
|
<file>../.php-cs-fixer.php</file>
|
||||||
</exclude>
|
</exclude>
|
||||||
</coverage>
|
</coverage>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Unit">
|
||||||
|
<directory>unit/</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace D3\DIContainerHandler\tests\unit\autoload;
|
namespace D3\DIContainerHandler\tests\autoload;
|
||||||
|
|
||||||
use D3\DIContainerHandler\d3DicException;
|
use D3\DIContainerHandler\d3DicException;
|
||||||
use D3\TestingTools\Development\CanAccessRestricted;
|
use D3\TestingTools\Development\CanAccessRestricted;
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace D3\DIContainerHandler\tests\unit;
|
namespace D3\DIContainerHandler\tests;
|
||||||
|
|
||||||
use D3\DIContainerHandler\d3DicException;
|
use D3\DIContainerHandler\d3DicException;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace D3\DIContainerHandler\tests\unit;
|
namespace D3\DIContainerHandler\tests;
|
||||||
|
|
||||||
use D3\DIContainerHandler\d3DicException;
|
use D3\DIContainerHandler\d3DicException;
|
||||||
use D3\DIContainerHandler\d3DicHandler;
|
use D3\DIContainerHandler\d3DicHandler;
|
||||||
@ -89,7 +87,6 @@ class d3DicHandlerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$sut = new d3DicHandler();
|
$sut = new d3DicHandler();
|
||||||
|
|
||||||
// test new instance
|
|
||||||
$containerBuilder = $this->callMethod(
|
$containerBuilder = $this->callMethod(
|
||||||
$sut,
|
$sut,
|
||||||
'getUncompiledInstance'
|
'getUncompiledInstance'
|
||||||
@ -101,22 +98,6 @@ class d3DicHandlerTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse($containerBuilder->isCompiled());
|
$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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,27 +133,24 @@ class d3DicHandlerTest extends TestCase
|
|||||||
* @param bool $throwException
|
* @param bool $throwException
|
||||||
* @param bool $expectException
|
* @param bool $expectException
|
||||||
* @param string $circularReferenceMethod
|
* @param string $circularReferenceMethod
|
||||||
* @param string $expectedExceptionMessage
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @covers \D3\DIContainerHandler\d3DicHandler::createInstance
|
* @covers \D3\DIContainerHandler\d3DicHandler::createInstance
|
||||||
* @dataProvider canCreateInstanceDataProvider
|
* @dataProvider canCreateInstanceDataProvider
|
||||||
*/
|
*/
|
||||||
public function canCreateInstance(bool $throwException, bool $expectException, string $circularReferenceMethod = '', string $expectedExceptionMessage = ''): void
|
public function canCreateInstance(bool $throwException, bool $expectException, string $circularReferenceMethod = '')
|
||||||
{
|
{
|
||||||
/** @var d3DicHandler|MockObject $sut */
|
/** @var d3DicHandler|MockObject $sut */
|
||||||
$sut = $this->getMockBuilder(d3DicHandler::class)
|
$sut = $this->getMockBuilder(d3DicHandler::class)
|
||||||
->onlyMethods(['buildContainer', 'getFunctionNameFromTrace'])
|
->onlyMethods(['buildContainer', 'getFunctionNameFromTrace'])
|
||||||
->getMock();
|
->getMock();
|
||||||
if ($throwException) {
|
if ($throwException)
|
||||||
$sut->method( 'buildContainer' )->willThrowException( new Exception( 'fixture' ) );
|
$sut->method( 'buildContainer' )->willThrowException( new Exception( 'fixture' ) );
|
||||||
}
|
|
||||||
|
|
||||||
$sut->method('getFunctionNameFromTrace')->willReturn($circularReferenceMethod);
|
$sut->method('getFunctionNameFromTrace')->willReturn($circularReferenceMethod);
|
||||||
if ($expectException) {
|
if ($expectException)
|
||||||
$this->expectException(d3DicException::class);
|
$this->expectException(d3DicException::class);
|
||||||
$this->expectExceptionMessage($expectedExceptionMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->callMethod(
|
$this->callMethod(
|
||||||
$sut,
|
$sut,
|
||||||
@ -183,8 +161,8 @@ class d3DicHandlerTest extends TestCase
|
|||||||
public function canCreateInstanceDataProvider(): Generator
|
public function canCreateInstanceDataProvider(): Generator
|
||||||
{
|
{
|
||||||
yield "don't throw exception" => [false, false];
|
yield "don't throw exception" => [false, false];
|
||||||
yield "throw exception" => [true, true, '', 'fixture'];
|
yield "throw exception" => [true, true];
|
||||||
yield "has circular reference method name" => [false, true, 'getViewConfig', 'method getViewConfig can\'t use DIC due the danger of circular reference'];
|
yield "has circular reference method name" => [false, true, 'getViewConfig'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -352,13 +330,13 @@ class d3DicHandlerTest extends TestCase
|
|||||||
* @test
|
* @test
|
||||||
* @param bool $useCacheContainer
|
* @param bool $useCacheContainer
|
||||||
* @param bool $compile
|
* @param bool $compile
|
||||||
* @param bool $useDefault
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @dataProvider buildContainerTestDataProvider
|
* @dataProvider buildContainerTestDataProvider
|
||||||
* @covers \D3\DIContainerHandler\d3DicHandler::buildContainer
|
* @covers \D3\DIContainerHandler\d3DicHandler::buildContainer
|
||||||
*/
|
*/
|
||||||
public function buildContainerTest(bool $useCacheContainer, bool $compile, bool $useDefault = false): void
|
public function buildContainerTest(bool $useCacheContainer, bool $compile): void
|
||||||
{
|
{
|
||||||
$structure = [
|
$structure = [
|
||||||
'source_directory' => [],
|
'source_directory' => [],
|
||||||
@ -374,31 +352,18 @@ class d3DicHandlerTest extends TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->onlyMethods(get_class_methods(PhpDumper::class))
|
->onlyMethods(get_class_methods(PhpDumper::class))
|
||||||
->getMock();
|
->getMock();
|
||||||
$phpDumperMock->expects($this->exactly((int) (!$useCacheContainer && $compile)))->method('dump')->willReturn('fixture');
|
$phpDumperMock->expects($this->exactly((int) (!$useCacheContainer && $compile)))->method('dump');
|
||||||
|
|
||||||
/** @var d3DicHandler|MockObject $sut */
|
/** @var d3DicHandler|MockObject $sut */
|
||||||
$sut = $this->getMockBuilder(d3DicHandler::class)
|
$sut = $this->getMockBuilder(d3DicHandler::class)
|
||||||
->onlyMethods(
|
->onlyMethods(['d3UseCachedContainer', 'd3GetCacheContainer', 'getContainerBuilder', 'd3GetCacheFilePath', 'getPhpDumper'])
|
||||||
[
|
|
||||||
'd3UseCachedContainer', 'd3GetCacheContainer', 'getContainerBuilder',
|
|
||||||
'loadFiles','d3GetCacheFilePath', 'getPhpDumper'
|
|
||||||
])
|
|
||||||
->getMock();
|
->getMock();
|
||||||
$sut->expects($this->once())->method('d3UseCachedContainer')->willReturn($useCacheContainer);
|
$sut->expects($this->once())->method('d3UseCachedContainer')->willReturn($useCacheContainer);
|
||||||
$sut->expects($this->exactly((int) $useCacheContainer))->method('d3GetCacheContainer');
|
$sut->expects($this->exactly((int) $useCacheContainer))->method('d3GetCacheContainer');
|
||||||
$sut->expects($this->exactly((int) !$useCacheContainer))->method('getContainerBuilder')->willReturn($containerBuilderMock);
|
$sut->expects($this->exactly((int) !$useCacheContainer))->method('getContainerBuilder')->willReturn($containerBuilderMock);
|
||||||
$sut->expects($this->exactly((int) !$useCacheContainer))->method('loadFiles');
|
$sut->method('d3GetCacheFilePath')->willReturn($fsRoot->getChild('source_directory')->path().'/DIContainer.php');
|
||||||
$sut->method('d3GetCacheFilePath')->willReturn($fsRoot->getChild('source_directory')->url().'/DIContainer.php');
|
|
||||||
$sut->method('getPhpDumper')->willReturn($phpDumperMock);
|
$sut->method('getPhpDumper')->willReturn($phpDumperMock);
|
||||||
|
|
||||||
$useDefault ?
|
|
||||||
$this->assertInstanceOf(
|
|
||||||
Container::class,
|
|
||||||
$this->callMethod(
|
|
||||||
$sut,
|
|
||||||
'buildContainer'
|
|
||||||
)
|
|
||||||
):
|
|
||||||
$this->assertInstanceOf(
|
$this->assertInstanceOf(
|
||||||
Container::class,
|
Container::class,
|
||||||
$this->callMethod(
|
$this->callMethod(
|
||||||
@ -407,13 +372,6 @@ class d3DicHandlerTest extends TestCase
|
|||||||
[$compile]
|
[$compile]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$useCacheContainer && $compile) {
|
|
||||||
$this->assertSame(
|
|
||||||
'fixture',
|
|
||||||
file_get_contents($fsRoot->getChild('source_directory')->url() . '/DIContainer.php')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildContainerTestDataProvider(): Generator
|
public function buildContainerTestDataProvider(): Generator
|
||||||
@ -421,7 +379,6 @@ class d3DicHandlerTest extends TestCase
|
|||||||
yield "can't use cached container, do compile" => [false, true];
|
yield "can't use cached container, do compile" => [false, true];
|
||||||
yield "can't use cached container, don't compile" => [false, false];
|
yield "can't use cached container, don't compile" => [false, false];
|
||||||
yield "use cached container" => [true, false];
|
yield "use cached container" => [true, false];
|
||||||
yield "can't use cached container, do compile, default" => [false, true, true];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -443,7 +400,7 @@ class d3DicHandlerTest extends TestCase
|
|||||||
->onlyMethods(['isProductiveMode', 'getConfigParam'])
|
->onlyMethods(['isProductiveMode', 'getConfigParam'])
|
||||||
->getMock();
|
->getMock();
|
||||||
$configMock->method('isProductiveMode')->willReturn($productive);
|
$configMock->method('isProductiveMode')->willReturn($productive);
|
||||||
$configMock->method('getConfigParam')->willReturnMap([['iDebug', null, $debug]]);
|
$configMock->method('getConfigParam')->willReturnMap([['iDebug', NULL, $debug]]);
|
||||||
|
|
||||||
/** @var d3DicHandler|MockObject $sut */
|
/** @var d3DicHandler|MockObject $sut */
|
||||||
$sut = $this->getMockBuilder(d3DicHandler::class)
|
$sut = $this->getMockBuilder(d3DicHandler::class)
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace D3\DIContainerHandler\tests\unit;
|
namespace D3\DIContainerHandler\tests;
|
||||||
|
|
||||||
use D3\DIContainerHandler\d3DicHandler;
|
use D3\DIContainerHandler\d3DicHandler;
|
||||||
use D3\DIContainerHandler\d3DicUtilities;
|
use D3\DIContainerHandler\d3DicUtilities;
|
||||||
@ -90,30 +88,16 @@ class d3DicUtilitiesTest extends TestCase
|
|||||||
* @test
|
* @test
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @covers \D3\DIContainerHandler\d3DicUtilities::getVendorDir()
|
* @covers \D3\DIContainerHandler\d3DicUtilities::getVendorDir()
|
||||||
* @dataProvider getVendorDirTestDataProvider
|
|
||||||
*/
|
*/
|
||||||
public function getVendorDirTest(string $path): void
|
public function getVendorDirTest(): void
|
||||||
{
|
{
|
||||||
$sut = oxNew(d3DicUtilities::class);
|
$sut = oxNew(d3DicUtilities::class);
|
||||||
|
|
||||||
$vendorDir = (string) $this->callMethod(
|
|
||||||
$sut,
|
|
||||||
'getVendorDir',
|
|
||||||
[$path]
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->assertSame('/var/www/html/vendor/', $vendorDir);
|
|
||||||
$this->assertDirectoryExists(
|
$this->assertDirectoryExists(
|
||||||
$this->callMethod(
|
(string) $this->callMethod(
|
||||||
$sut,
|
$sut,
|
||||||
'getVendorDir'
|
'getVendorDir'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getVendorDirTestDataProvider(): Generator
|
|
||||||
{
|
|
||||||
yield 'default' => ['/var/www/html/vendor/d3/oxid-dic-handler/d3DicUtilities.php'];
|
|
||||||
yield 'space after' => ['/var/www/html/vendor/d3/oxid-dic-handler/d3DicUtilities.php '];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
* For the full copyright and license information, please view the LICENSE
|
||||||
*
|
* file that was distributed with this source code.
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace D3\DIContainerHandler\tests\unit;
|
namespace D3\DIContainerHandler\tests;
|
||||||
|
|
||||||
use Assert\InvalidArgumentException;
|
use Assert\InvalidArgumentException;
|
||||||
use D3\DIContainerHandler\definitionFileContainer;
|
use D3\DIContainerHandler\definitionFileContainer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user