mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Update TestKernel.php
This commit is contained in:
parent
e45127d88b
commit
69fd3b1418
1 changed files with 14 additions and 7 deletions
|
|
@ -18,6 +18,7 @@ class TestKernel extends Kernel
|
|||
|
||||
if (!in_array($this->environment, ['test', 'test_cached'])) {
|
||||
parent::shutdown();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -42,15 +43,21 @@ class TestKernel extends Kernel
|
|||
}
|
||||
|
||||
$serviceObject = new \ReflectionObject($service);
|
||||
foreach ($serviceObject->getProperties() as $prop) {
|
||||
$prop->setAccessible(true);
|
||||
if ($prop->isStatic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$prop->setValue($service, null);
|
||||
$properties = $serviceObject->getProperties();
|
||||
// If it has a static property it could be a singleton, therefore we should not
|
||||
// reset it's properties
|
||||
foreach ($properties as $property) {
|
||||
if ($property->isStatic()) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($properties as $property) {
|
||||
$property->setAccessible(true);
|
||||
$property->setValue($service, null);
|
||||
}
|
||||
}
|
||||
$property->setValue($container, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue