Skip to content
Snippets Groups Projects
Commit 49450265 authored by catch's avatar catch
Browse files

Issue #3406024 by neclimdul, Spokje, longwave, mondrake, smustgrave, alexpott:...

Issue #3406024 by neclimdul, Spokje, longwave, mondrake, smustgrave, alexpott: DependencySerializationTrait depends on removed __PHPUNIT_BOOTSTRAP global
parent 320e5fd6
No related branches found
No related tags found
No related merge requests found
......@@ -72,31 +72,14 @@ public function __sleep() {
*/
#[\ReturnTypeWillChange]
public function __wakeup() {
// Tests in isolation potentially unserialize in the parent process.
$phpunit_bootstrap = isset($GLOBALS['__PHPUNIT_BOOTSTRAP']);
if ($phpunit_bootstrap && !\Drupal::hasContainer()) {
return;
}
$container = \Drupal::getContainer();
foreach ($this->_serviceIds as $key => $service_id) {
// In rare cases, when test data is serialized in the parent process,
// there is a service container but it doesn't contain all expected
// services. To avoid fatal errors during the wrap-up of failing tests, we
// check for this case, too.
if ($phpunit_bootstrap && !$container->has($service_id)) {
continue;
}
$this->$key = $container->get($service_id);
$this->$key = \Drupal::service($service_id);
}
$this->_serviceIds = [];
// In rare cases, when test data is serialized in the parent process, there
// is a service container but it doesn't contain all expected services. To
// avoid fatal errors during the wrap-up of failing tests, we check for this
// case, too.
if ($this->_entityStorages && (!$phpunit_bootstrap || $container->has('entity_type.manager'))) {
if ($this->_entityStorages) {
/** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
$entity_type_manager = $container->get('entity_type.manager');
$entity_type_manager = \Drupal::service('entity_type.manager');
foreach ($this->_entityStorages as $key => $entity_type_id) {
$this->$key = $entity_type_manager->getStorage($entity_type_id);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment