diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php index 80128f87e8..c2883f844f 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php @@ -42,7 +42,7 @@ protected function setUp() { ], ]; // File API functions are not available yet. - $path = $this->siteDirectory . '/profiles/mydistro'; + $path = $this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/profiles/mydistro'; mkdir($path, 0777, TRUE); file_put_contents("$path/mydistro.info.yml", Yaml::encode($this->info)); @@ -66,11 +66,11 @@ protected function visitInstaller() { // The language should have been automatically detected, all following // screens should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEqual((string) current($elements), 'Save and continue de'); + $this->assertEqual(current($elements)->getText(), 'Save and continue de'); $this->translations['Save and continue'] = 'Save and continue de'; // Check the language direction. - $direction = (string) current($this->xpath('/html/@dir')); + $direction = current($this->xpath('/html/@dir'))->getText(); $this->assertEqual($direction, 'ltr'); // Verify that the distribution name appears. diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php index 1d8cc7d40b..ef3fda58d7 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php @@ -42,7 +42,7 @@ protected function setUp() { ], ]; // File API functions are not available yet. - $path = $this->siteDirectory . '/profiles/mydistro'; + $path = $this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/profiles/mydistro'; mkdir($path, 0777, TRUE); file_put_contents("$path/mydistro.info.yml", Yaml::encode($this->info)); @@ -62,11 +62,11 @@ protected function visitInstaller() { // The language should have been automatically detected, all following // screens should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEqual((string) current($elements), 'Save and continue de'); + $this->assertEqual(current($elements)->getText(), 'Save and continue de'); $this->translations['Save and continue'] = 'Save and continue de'; // Check the language direction. - $direction = (string) current($this->xpath('/html/@dir')); + $direction = current($this->xpath('/@dir'))->getText(); $this->assertEqual($direction, 'ltr'); // Verify that the distribution name appears. diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php index fcdfaddcb5..b2cb24ed2b 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php @@ -14,7 +14,9 @@ class InstallerEmptySettingsTest extends InstallerTestBase { */ protected function setUp() { // Create an empty settings.php file. - touch($this->siteDirectory . '/settings.php'); + $path = $this->root . DIRECTORY_SEPARATOR . $this->siteDirectory; + mkdir($path, 0777, TRUE); + file_put_contents($path . '/settings.php', ''); parent::setUp(); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php index 118b143a4a..fb05decc3f 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php @@ -20,7 +20,8 @@ class InstallerExistingConfigDirectoryTest extends InstallerTestBase { * {@inheritdoc} */ protected function setUp() { - mkdir($this->siteDirectory . '/config_read_only', 0444); + mkdir($this->root . DIRECTORY_SEPARATOR . $this->siteDirectory, 0755); + mkdir($this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/config_read_only', 0444); $this->expectedFilePerms = fileperms($this->siteDirectory . '/config_read_only'); $this->settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [ 'value' => $this->siteDirectory . '/config_read_only', diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileBrokenTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileBrokenTest.php index 1a3a304b5f..32709df493 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileBrokenTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileBrokenTest.php @@ -11,7 +11,7 @@ * * @group Installer */ -class InstallerExistingSettingsMismatchProfileBrokenTest extends InstallerTestBase { + class InstallerExistingSettingsMismatchProfileBrokenTest extends InstallerTestBase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php index 4aab2de4f6..da63ec9b30 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php @@ -32,7 +32,7 @@ protected function setUpLanguage() { $this->translations['Save and continue'] = 'Save and continue Arabic'; // Verify that language direction is right-to-left. - $direction = current($this->xpath('/html/@dir'))->getText(); + $direction = current($this->xpath('/@dir'))->getText(); $this->assertEqual($direction, 'rtl'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php index c0ccd89228..bc2c78d386 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php @@ -31,11 +31,11 @@ public function testInstaller() { protected function setUpLanguage() { // Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets and // metatags as expected to the first page of the installer. - $this->assertRaw('core/themes/seven/css/components/buttons.css'); + $this->assertRaw("core/themes/bartik/css/components/buttons.css"); $this->assertRaw(''); // Assert that the expected title is present. - $this->assertEqual('Choose language', $this->cssSelect('main h2')[0]); + $this->assertEqual('Choose language', $this->cssSelect('main h1')[0]); parent::setUpLanguage(); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php index 2ce0da8f7f..eb9bf6789f 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php @@ -2,8 +2,11 @@ namespace Drupal\FunctionalTests\Installer; +require_once __DIR__ . '/../../../../includes/bootstrap.inc'; + use Drupal\Core\DrupalKernel; use Drupal\Core\Language\Language; +use Drupal\Core\Logger\LoggerChannelFactory; use Drupal\Core\Session\UserSession; use Drupal\Core\Site\Settings; use Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware; @@ -69,6 +72,18 @@ */ protected $isInstalled = FALSE; + /** + * {@inheritdoc} + */ + public function __construct($test_id = NULL) { + parent::__construct($test_id); + $this->setupBaseUrl(); + + // Install Drupal test site. + $this->prepareEnvironment(); + $this->prepareDatabasePrefix(); + } + /** * {@inheritdoc} */ @@ -124,6 +139,14 @@ protected function setUp() { $this->container ->register('http_client_factory', 'Drupal\Core\Http\ClientFactory') ->setArguments([new Reference('http_handler_stack')]); + $this->container + ->register('file_system', 'Drupal\Core\File\FileSystem') + ->addArgument(new Reference('stream_wrapper_manager')) + ->addArgument(Settings::getInstance()) + ->addArgument((new LoggerChannelFactory())->get('file')); + $this->container + ->register('stream_wrapper_manager', 'Drupal\Core\StreamWrapper\StreamWrapperManager') + ->addMethodCall('setContainer', [new Reference('service_container')]); $handler_stack = HandlerStack::create(); $handler_stack->push((new TestHttpClientMiddleware())(), 'test.http_client.middleware'); $this->container @@ -136,6 +159,21 @@ protected function setUp() { // Setup Mink. $session = $this->initMink(); + +// $this->prepareSettings(); +// require_once DRUPAL_ROOT . '/core/includes/install.core.inc'; +// $settings = $this->parameters; +// global $install_state; +// // Initialize the installation state with the settings that were passed in, +// // as well as a boolean indicating whether or not this is an interactive +// // installation. +// $interactive = empty($this->parameters); +// $install_state = $this->parameters + ['interactive' => $interactive] + install_state_defaults(); +// install_begin_request($this->classLoader, $install_state); +// // Based on the installation state, run the remaining tasks for this page +// // request, and collect any output. +// $output = install_run_tasks($install_state); + $this->visitInstaller(); // Select language. diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php index 5606b8fbe4..8a6cc1e8c3 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php @@ -33,11 +33,11 @@ protected function visitInstaller() { // The language should have been automatically detected, all following // screens should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEqual((string) current($elements), 'Save and continue de'); + $this->assertEqual(current($elements)->getText(), 'Save and continue de'); $this->translations['Save and continue'] = 'Save and continue de'; // Check the language direction. - $direction = (string) current($this->xpath('/html/@dir')); + $direction = current($this->xpath('/@dir'))->getText(); $this->assertEqual($direction, 'ltr'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php index 97ca133d5a..974d282588 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php @@ -32,11 +32,11 @@ protected function setUpLanguage() { // After selecting a different language than English, all following screens // should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEqual((string) current($elements), 'Save and continue de'); + $this->assertEqual(current($elements)->getText(), 'Save and continue de'); $this->translations['Save and continue'] = 'Save and continue de'; // Check the language direction. - $direction = (string) current($this->xpath('/html/@dir')); + $direction = current($this->xpath('/@dir'))->getText(); $this->assertEqual($direction, 'ltr'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php index e3ff8094ef..491e2b5fa9 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php @@ -37,7 +37,7 @@ protected function setUp() { ], ]; // File API functions are not available yet. - $path = $this->siteDirectory . '/profiles/' . $name; + $path = $this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/profiles/' . $name; mkdir($path, 0777, TRUE); file_put_contents("$path/$name.info.yml", Yaml::encode($info)); }