diff --git a/core/modules/simpletest/src/InstallerTestBase.php b/core/modules/simpletest/src/InstallerTestBase.php index e735ce3..4befd78 100644 --- a/core/modules/simpletest/src/InstallerTestBase.php +++ b/core/modules/simpletest/src/InstallerTestBase.php @@ -7,7 +7,10 @@ namespace Drupal\simpletest; +use Drupal\Core\Language\Language; use Drupal\Core\Session\UserSession; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\HttpFoundation\Request; /** * Base class for testing the interactive installer. @@ -91,6 +94,22 @@ protected function setUp() { // @see WebTestBase::translatePostValues() $this->parameters = $this->installParameters(); + // WebTestBase::curlExec calls into format_size and that depends on the + // string_translation service. Because the parent constructor is disabled + // entirely, it is necessary to set up the string_translation service here + // before calling WebTestBase::drupalGet() + $this->container->setParameter('language.default_values', Language::$defaultValues); + $this->container->register('language.default', 'Drupal\Core\Language\LanguageDefault') + ->addArgument('%language.default_values%'); + $this->container->register('language_manager', 'Drupal\Core\Language\LanguageManager') + ->addArgument(new Reference('language.default')); + $this->container->register('string_translation', 'Drupal\Core\StringTranslation\TranslationManager') + ->addArgument(new Reference('language_manager')); + + // Make sure the container has a request service, otherwise calls to + // $this->drupalGet() will fail. + $this->container->set('request', Request::createFromGlobals()); + $this->drupalGet($GLOBALS['base_url'] . '/core/install.php'); // Select language. diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index 5938426..48f273f 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -16,14 +16,11 @@ use Drupal\Core\Database\ConnectionNotDefinedException; use Drupal\Core\Config\StorageInterface; use Drupal\Core\DrupalKernel; -use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountProxy; use Drupal\Core\Session\AnonymousUserSession; use Drupal\Core\Site\Settings; use Drupal\Core\StreamWrapper\PublicStream; use Drupal\Core\Utility\Error; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\DependencyInjection\Reference; /** * Base class for Drupal tests. diff --git a/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php b/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php index 9d0be54..a3ab7b3 100644 --- a/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php +++ b/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php @@ -7,12 +7,12 @@ namespace Drupal\system\Tests\Plugin\Discovery; -use Drupal\simpletest\UnitTestBase; +use Drupal\simpletest\DrupalUnitTestBase; /** * Base class for plugin discovery tests. */ -abstract class DiscoveryTestBase extends UnitTestBase { +abstract class DiscoveryTestBase extends DrupalUnitTestBase { /** * The discovery component to test. diff --git a/core/modules/system/src/Tests/Plugin/PluginTestBase.php b/core/modules/system/src/Tests/Plugin/PluginTestBase.php index 3a92dbd..bd97bba 100644 --- a/core/modules/system/src/Tests/Plugin/PluginTestBase.php +++ b/core/modules/system/src/Tests/Plugin/PluginTestBase.php @@ -7,7 +7,7 @@ namespace Drupal\system\Tests\Plugin; -use Drupal\simpletest\UnitTestBase; +use Drupal\simpletest\DrupalUnitTestBase; use Drupal\plugin_test\Plugin\TestPluginManager; use Drupal\plugin_test\Plugin\MockBlockManager; use Drupal\plugin_test\Plugin\DefaultsTestPluginManager; @@ -17,7 +17,7 @@ /** * Base class for Plugin API unit tests. */ -abstract class PluginTestBase extends UnitTestBase { +abstract class PluginTestBase extends DrupalUnitTestBase { protected $testPluginManager; protected $testPluginExpectedDefinitions; protected $mockBlockManager;