public function KernelTestBaseTest::testSetUp in Drupal 8
Same name in this branch
- 8 core/tests/Drupal/KernelTests/KernelTestBaseTest.php \Drupal\KernelTests\KernelTestBaseTest::testSetUp()
- 8 core/modules/simpletest/src/Tests/KernelTestBaseTest.php \Drupal\simpletest\Tests\KernelTestBaseTest::testSetUp()
Tests expected behavior of setUp().
File
- core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php, line 53
Class
- KernelTestBaseTest
- Tests KernelTestBase functionality.
Namespace
Drupal\simpletest\TestsCode
public function testSetUp() {
$modules = [
'entity_test',
];
$table = 'entity_test';
// Verify that specified $modules have been loaded.
$this
->assertTrue(function_exists('entity_test_entity_bundle_info'), 'entity_test.module was loaded.');
// Verify that there is a fixed module list.
$this
->assertIdentical(array_keys(\Drupal::moduleHandler()
->getModuleList()), $modules);
$this
->assertIdentical(\Drupal::moduleHandler()
->getImplementations('entity_bundle_info'), [
'entity_test',
]);
$this
->assertIdentical(\Drupal::moduleHandler()
->getImplementations('entity_type_alter'), [
'entity_test',
]);
// Verify that no modules have been installed.
$this
->assertFalse(Database::getConnection()
->schema()
->tableExists($table), "'{$table}' database table not found.");
// Verify that the settings.testing.php got taken into account.
$this
->assertTrue(function_exists('simpletest_test_stub_settings_function'));
// Ensure that the database tasks have been run during set up. Neither MySQL
// nor SQLite make changes that are testable.
$database = $this->container
->get('database');
if ($database
->driver() == 'pgsql') {
$this
->assertEqual('on', $database
->query("SHOW standard_conforming_strings")
->fetchField());
$this
->assertEqual('escape', $database
->query("SHOW bytea_output")
->fetchField());
}
}