restore definition of modified service, required for cascaded compiler passes like in ModuleSettingService

This commit is contained in:
Daniel Seifert 2025-05-19 23:09:02 +02:00
parent 10e0afa20f
commit 5c68038d64
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
4 changed files with 22 additions and 2 deletions

View File

@ -4,8 +4,19 @@ 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased](https://git.d3data.de/D3Public/TestingTools/compare/1.0.0.0...rel_1.x)
- can modify DI container services in runtime
## [Unreleased](https://git.d3data.de/D3Public/TestingTools/compare/1.3.0.0...rel_1.x)
## [1.3.0.0](https://git.d3data.de/D3Public/TestingTools/compare/1.2.0.0...1.3.0.0) - 2025-05-19
### Added
- can modify DI container services at runtime
## [1.2.0.0](https://git.d3data.de/D3Public/TestingTools/compare/1.1.0.0...1.2.0.0) - 2024-02-01
### Removed
- PHP7 support
## [1.1.0.0](https://git.d3data.de/D3Public/TestingTools/compare/1.0.0.0...1.1.0.0) - 2022-12-07
### Added
- generic OXID class instance getters
## [1.0.0.0](https://git.d3data.de/D3Public/TestingTools/releases/tag/1.0.0.0) - 2022-11-11
### Added

View File

@ -35,6 +35,9 @@ Include the respective trait in your class and use the desired method in your co
```
use \D3\TestingTools\Production\IsMockable;
```
```
use \D3\TestingTools\Development\CanAccessRestricted;
```
## Changelog

View File

@ -36,6 +36,9 @@ Binden Sie den jeweiligen Trait in Ihre Klasse ein und verwenden die gewünschte
```
use \D3\TestingTools\Production\IsMockable;
```
```
use \D3\TestingTools\Development\CanAccessRestricted;
```
## Changelog

View File

@ -23,6 +23,7 @@ use PHPUnit\Framework\MockObject\MockObject;
use ReflectionClass;
use ReflectionException;
use ReflectionProperty;
use Symfony\Component\DependencyInjection\Definition;
trait CanAccessRestricted
{
@ -124,7 +125,9 @@ trait CanAccessRestricted
array_walk($services, function ($service, $serviceId) use ($builder) {
if ($builder->has($serviceId)) {
$definition = $builder->getDefinition($serviceId);
$builder->set($serviceId, $service);
$builder->setDefinition($serviceId, $definition);
}
});