class InstallerExistingBrokenDatabaseSettingsTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php \Drupal\FunctionalTests\Installer\InstallerExistingBrokenDatabaseSettingsTest
Tests the installer with broken database connection info in settings.php.
@group Installer
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Installer\InstallerTestBase uses \Drupal\Tests\RequirementsPageTrait implements \Drupal\Tests\BrowserTestBase
- class \Drupal\FunctionalTests\Installer\InstallerExistingBrokenDatabaseSettingsTest implements \Drupal\FunctionalTests\Installer\InstallerTestBase
- class \Drupal\FunctionalTests\Installer\InstallerTestBase uses \Drupal\Tests\RequirementsPageTrait implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of InstallerExistingBrokenDatabaseSettingsTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerExistingBrokenDatabaseSettingsTest.php, line 12
Namespace
Drupal\FunctionalTests\InstallerView source
class InstallerExistingBrokenDatabaseSettingsTest extends InstallerTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function prepareEnvironment() {
parent::prepareEnvironment();
// Pre-configure database credentials in settings.php.
$connection_info = Database::getConnectionInfo();
if ($connection_info['default']['driver'] !== 'mysql') {
$this->markTestSkipped('This test relies on overriding the mysql driver');
}
// Use a database driver that reports a fake database version that does
// not meet requirements.
unset($connection_info['default']['pdo']);
unset($connection_info['default']['init_commands']);
$connection_info['default']['driver'] = 'DrivertestMysqlDeprecatedVersion';
$namespace = 'Drupal\\driver_test\\Driver\\Database\\DrivertestMysqlDeprecatedVersion';
$connection_info['default']['namespace'] = $namespace;
$connection_info['default']['autoload'] = Database::findDriverAutoloadDirectory($namespace, \Drupal::root());
$this->settings['databases']['default'] = (object) [
'value' => $connection_info,
'required' => TRUE,
];
}
/**
* {@inheritdoc}
*/
protected function setUpSettings() {
// This form will never be reached.
}
/**
* {@inheritdoc}
*/
protected function setUpRequirementsProblem() {
// The parent method asserts that there are no requirements errors, but
// this test expects a requirements error in the test method below.
// Therefore, we override this method to suppress the parent's assertions.
}
/**
* {@inheritdoc}
*/
protected function setUpSite() {
// This form will never be reached.
}
/**
* Tests the expected requirements problem.
*/
public function testRequirementsProblem() {
$this->assertSession()
->titleEquals('Requirements problem | Drupal');
$this->assertSession()
->pageTextContains('Database settings');
$this->assertSession()
->pageTextContains('Resolve all issues below to continue the installation. For help configuring your database server,');
$this->assertSession()
->pageTextContains('The database server version 10.2.31-MariaDB-1:10.2.31+maria~bionic-log is less than the minimum required version');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.