Issue #2527710 by Fabianx: Decouple Error testing from running with container builder
parent
48aa09b423
commit
f3a857f133
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\error_service_test\ErrorServiceTestServiceProvider.
|
||||
*/
|
||||
|
||||
namespace Drupal\error_service_test;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Drupal\Core\DependencyInjection\ServiceModifierInterface;
|
||||
|
||||
class ErrorServiceTestServiceProvider implements ServiceModifierInterface {
|
||||
|
||||
/**
|
||||
* The in-situ container builder.
|
||||
*
|
||||
* @var \Drupal\Core\DependencyInjection\ContainerBuilder
|
||||
*/
|
||||
public static $containerBuilder;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function alter(ContainerBuilder $container) {
|
||||
static::$containerBuilder = $container;
|
||||
}
|
||||
}
|
|
@ -44,7 +44,11 @@ class MonkeysInTheControlRoom implements HttpKernelInterface {
|
|||
$kernel = \Drupal::service('kernel');
|
||||
$kernel->rebuildContainer();
|
||||
// 2) Fetch the in-situ container builder.
|
||||
$container = $kernel->getContainer();
|
||||
$container = ErrorServiceTestServiceProvider::$containerBuilder;
|
||||
// Ensure the compiler pass worked.
|
||||
if (!$container) {
|
||||
throw new \Exception('Oh oh, monkeys stole the ServiceProvider.');
|
||||
}
|
||||
// Stop the theme manager from being found - and triggering error
|
||||
// maintenance mode.
|
||||
$container->removeDefinition('theme.manager');
|
||||
|
|
Loading…
Reference in New Issue