diff --git a/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php b/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php index 773b778..d489cbc 100644 --- a/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php +++ b/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\inline_form_errors\Unit; +use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormState; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Utility\LinkGeneratorInterface; @@ -15,6 +17,16 @@ class FormErrorHandlerTest extends UnitTestCase { /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $container = new ContainerBuilder(); + $container->set('module_handler', $this->getMock(ModuleHandlerInterface::class)); + \Drupal::setContainer($container); + } + + /** * @covers ::handleFormErrors * @covers ::displayErrorMessages */ diff --git a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php index 238b5c8..8592da0 100644 --- a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php +++ b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php @@ -5,6 +5,7 @@ use Drupal\Core\Datetime\DateFormatter; use Drupal\Core\Datetime\FormattedDateDiff; use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Drupal\Core\StringTranslation\TranslatableMarkup; @@ -73,6 +74,7 @@ protected function setUp() { $container = new ContainerBuilder(); $container->set('config.factory', $config_factory); $container->set('string_translation', $this->getStringTranslationStub()); + $container->set('module_handler', $this->getMock(ModuleHandlerInterface::class)); \Drupal::setContainer($container); $this->dateFormatter = new DateFormatter($this->entityManager, $this->languageManager, $this->stringTranslation, $this->getConfigFactoryStub(), $this->requestStack); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php index 8ee7478..c96eb20 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @@ -2,8 +2,10 @@ namespace Drupal\Tests\Core\Entity; +use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityType; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Tests\UnitTestCase; @@ -14,6 +16,16 @@ class EntityTypeTest extends UnitTestCase { /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $container = new ContainerBuilder(); + $container->set('module_handler', $this->getMock(ModuleHandlerInterface::class)); + \Drupal::setContainer($container); + } + + /** * Sets up an EntityType object for a given set of values. * * @param array $definition diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php index 560675e..47f1bba 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\Core\StringTranslation; +use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\StringTranslation\PluralTranslatableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\StringTranslation\TranslationInterface; @@ -42,6 +44,10 @@ protected function setUp() { }); $this->translation->setStringTranslation($mock->reveal()); $this->reflection = new \ReflectionClass(get_class($this->translation)); + + $container = new ContainerBuilder(); + $container->set('module_handler', $this->getMock(ModuleHandlerInterface::class)); + \Drupal::setContainer($container); } /** diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php index 8ab6874..619447b 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php @@ -8,6 +8,8 @@ namespace Drupal\Tests\Core\StringTranslation; use Drupal\Component\Render\MarkupInterface; +use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\StringTranslation\TranslationManager; use Drupal\Tests\UnitTestCase; @@ -28,7 +30,11 @@ class TranslationManagerTest extends UnitTestCase { * {@inheritdoc} */ protected function setUp() { + parent::setUp(); $this->translationManager = new TestTranslationManager(); + $container = new ContainerBuilder(); + $container->set('module_handler', $this->getMock(ModuleHandlerInterface::class)); + \Drupal::setContainer($container); } /**