function InstallerNonDefaultDatabaseDriverTest::testInstalled
Confirms that the installation succeeded.
File
-
core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerNonDefaultDatabaseDriverTest.php, line 61
Class
- InstallerNonDefaultDatabaseDriverTest
- Tests the interactive installer.
Namespace
Drupal\FunctionalTests\InstallerCode
public function testInstalled() : void {
$this->assertSession()
->addressEquals('user/1');
$this->assertSession()
->statusCodeEquals(200);
// Assert that in the settings.php the database connection array has the
// correct values set.
$installedDatabaseSettings = $this->getInstalledDatabaseSettings();
$this->assertSame("Drupal\\driver_test\\Driver\\Database\\{$this->testDriverName}", $installedDatabaseSettings['default']['default']['namespace']);
$this->assertSame($this->testDriverName, $installedDatabaseSettings['default']['default']['driver']);
$this->assertSame("core/modules/system/tests/modules/driver_test/src/Driver/Database/{$this->testDriverName}/", $installedDatabaseSettings['default']['default']['autoload']);
$this->assertEquals([
'mysql' => [
'namespace' => 'Drupal\\mysql',
'autoload' => 'core/modules/mysql/src/',
],
'pgsql' => [
'namespace' => 'Drupal\\pgsql',
'autoload' => 'core/modules/pgsql/src/',
],
], $installedDatabaseSettings['default']['default']['dependencies']);
// Assert that the module "driver_test" and its dependencies have been
// installed.
$this->drupalGet('admin/modules');
$this->assertSession()
->checkboxChecked('modules[driver_test][enable]');
$this->assertSession()
->checkboxChecked('modules[mysql][enable]');
$this->assertSession()
->checkboxChecked('modules[pgsql][enable]');
// The module "driver_test" can not be uninstalled, because it is providing
// the database driver. Also, the "mysql" and "pgsql" modules can not be
// uninstalled being dependencies of the "driver_test" module.
$this->drupalGet('admin/modules/uninstall');
$this->assertSession()
->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-driver-test"]', "The following reason prevents Contrib database driver test from being uninstalled: The module 'Contrib database driver test' is providing the database driver '{$this->testDriverName}'.");
$this->assertSession()
->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-mysql"]', "The following reason prevents MySQL from being uninstalled: Required by: Contrib database driver test (driver_test)");
$this->assertSession()
->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-pgsql"]', "The following reason prevents PostgreSQL from being uninstalled: Required by: Contrib database driver test (driver_test)");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.