InstallerExistingSettingsMismatchProfileTest.php in Drupal 8
File
core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileTest.php
View source
<?php
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Site\Settings;
use Drupal\Core\Database\Database;
use Symfony\Component\HttpFoundation\Request;
class InstallerExistingSettingsMismatchProfileTest extends InstallerTestBase {
protected $defaultTheme = 'stark';
protected function prepareEnvironment() {
parent::prepareEnvironment();
$this->settings['settings']['hash_salt'] = (object) [
'value' => __CLASS__,
'required' => TRUE,
];
$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,
];
$this->settings['settings']['install_profile'] = (object) [
'value' => 'minimal',
'required' => TRUE,
];
$this->settings['settings']['config_sync_directory'] = (object) [
'value' => DrupalKernel::findSitePath(Request::createFromGlobals()) . '/files/config_sync',
'required' => TRUE,
];
mkdir($this->settings['settings']['config_sync_directory']->value, 0777, TRUE);
}
protected function visitInstaller() {
$this
->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=en&profile=testing');
}
protected function setUpLanguage() {
}
protected function setUpProfile() {
}
protected function setUpSettings() {
}
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');
}
}