$this->
assertSession()->
addressEquals('user/1'
);
$this->
assertSession()->
statusCodeEquals(200
);
// Assert that in the settings.php the database connection array has the
// correct values set.
$contents =
file_get_contents($this->container->
getParameter('app.root'
) . '/' .
$this->siteDirectory . '/settings.php'
);
$this->
assertStringContainsString("'namespace' => 'Drupal\\\\driver_test\\\\Driver\\\\Database\\\\{
$this->testDriverName
}',",
$contents);
$this->
assertStringContainsString("'driver' => '{
$this->testDriverName
}',",
$contents);
$this->
assertStringContainsString("'autoload' => 'core/modules/system/tests/modules/driver_test/src/Driver/Database/{
$this->testDriverName
}/',",
$contents);
// Assert that the module "driver_test" has been installed.
$this->
assertEquals(\Drupal::
service('module_handler'
)->
getModule('driver_test'
),
new Extension($this->root, 'module', 'core/modules/system/tests/modules/driver_test/driver_test.info.yml'
));
// Change the default database connection to use the database driver from
// the module "driver_test".
$connection_info = Database::
getConnectionInfo();
$driver_test_connection =
$connection_info['default'
];
$driver_test_connection['driver'
] =
$this->testDriverName;
$driver_test_connection['namespace'
] = 'Drupal\\driver_test\\Driver\\Database\\' .
$this->testDriverName;
$driver_test_connection['autoload'
] = "core/modules/system/tests/modules/driver_test/src/Driver/Database/{
$this->testDriverName
}/";
Database::
renameConnection('default', 'original_database_connection'
);
Database::
addConnectionInfo('default', 'default',
$driver_test_connection);