X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Fsrc%2FTests%2FInstaller%2FInstallerExistingSettingsMismatchProfileTest.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Fsrc%2FTests%2FInstaller%2FInstallerExistingSettingsMismatchProfileTest.php;h=0349fe515244e6bb0150c2d64b7f5be5563b3e7e;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/system/src/Tests/Installer/InstallerExistingSettingsMismatchProfileTest.php b/web/core/modules/system/src/Tests/Installer/InstallerExistingSettingsMismatchProfileTest.php new file mode 100644 index 000000000..0349fe515 --- /dev/null +++ b/web/core/modules/system/src/Tests/Installer/InstallerExistingSettingsMismatchProfileTest.php @@ -0,0 +1,101 @@ +settings['settings']['hash_salt'] = (object) [ + 'value' => __CLASS__, + 'required' => TRUE, + ]; + + // Pre-configure database credentials. + $connection_info = Database::getConnectionInfo(); + unset($connection_info['default']['pdo']); + unset($connection_info['default']['init_commands']); + + $this->settings['databases']['default'] = (object) [ + 'value' => $connection_info, + 'required' => TRUE, + ]; + + // During interactive install we'll change this to a different profile and + // this test will ensure that the new value is written to settings.php. + $this->settings['settings']['install_profile'] = (object) [ + 'value' => 'minimal', + 'required' => TRUE, + ]; + + // Pre-configure config directories. + $this->settings['config_directories'] = [ + CONFIG_SYNC_DIRECTORY => (object) [ + 'value' => DrupalKernel::findSitePath(Request::createFromGlobals()) . '/files/config_sync', + 'required' => TRUE, + ], + ]; + mkdir($this->settings['config_directories'][CONFIG_SYNC_DIRECTORY]->value, 0777, TRUE); + + parent::setUp(); + } + + /** + * {@inheritdoc} + */ + protected function visitInstaller() { + // Provide profile and language in query string to skip these pages. + $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=en&profile=testing'); + } + + /** + * {@inheritdoc} + */ + protected function setUpLanguage() { + // This step is skipped, because there is a lagcode as a query param. + } + + /** + * {@inheritdoc} + */ + protected function setUpProfile() { + // This step is skipped, because there is a profile as a query param. + } + + /** + * {@inheritdoc} + */ + protected function setUpSettings() { + // This step should not appear, since settings.php is fully configured + // already. + } + + /** + * Verifies that installation succeeded. + */ + public function testInstaller() { + $this->assertUrl('user/1'); + $this->assertResponse(200); + $this->assertEqual('testing', \Drupal::installProfile()); + $this->assertEqual('testing', Settings::get('install_profile'), 'Profile was correctly changed to testing in Settings.php'); + } + +}