protected function KernelTestBase::installEntitySchema in Zircon Profile 8
Same name in this branch
- 8 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::installEntitySchema()
- 8 core/modules/simpletest/src/KernelTestBase.php \Drupal\simpletest\KernelTestBase::installEntitySchema()
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/KernelTestBase.php \Drupal\simpletest\KernelTestBase::installEntitySchema()
Installs the storage schema for a specific entity type.
Parameters
string $entity_type_id: The ID of the entity type.
187 calls to KernelTestBase::installEntitySchema()
- ActionUnitTest::setUp in core/
modules/ system/ src/ Tests/ Action/ ActionUnitTest.php - Performs setup tasks before each individual test method is run.
- AggregatorFeedViewsFieldAccessTest::setUp in core/
modules/ aggregator/ src/ Tests/ Views/ AggregatorFeedViewsFieldAccessTest.php - Performs setup tasks before each individual test method is run.
- AggregatorItemViewsFieldAccessTest::setUp in core/
modules/ aggregator/ src/ Tests/ Views/ AggregatorItemViewsFieldAccessTest.php - Performs setup tasks before each individual test method is run.
- AggregatorTitleTest::setUp in core/
modules/ aggregator/ src/ Tests/ AggregatorTitleTest.php - Performs setup tasks before each individual test method is run.
- AreaEntityTest::setUpFixtures in core/
modules/ views/ src/ Tests/ Handler/ AreaEntityTest.php - Sets up the configuration and schema of views and views_test_data modules.
File
- core/
modules/ simpletest/ src/ KernelTestBase.php, line 454 - Contains \Drupal\simpletest\KernelTestBase.
Class
- KernelTestBase
- Base class for integration tests.
Namespace
Drupal\simpletestCode
protected function installEntitySchema($entity_type_id) {
/** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
$entity_manager = $this->container
->get('entity.manager');
$entity_type = $entity_manager
->getDefinition($entity_type_id);
$entity_manager
->onEntityTypeCreate($entity_type);
// For test runs, the most common storage backend is a SQL database. For
// this case, ensure the tables got created.
$storage = $entity_manager
->getStorage($entity_type_id);
if ($storage instanceof SqlEntityStorageInterface) {
$tables = $storage
->getTableMapping()
->getTableNames();
$db_schema = $this->container
->get('database')
->schema();
$all_tables_exist = TRUE;
foreach ($tables as $table) {
if (!$db_schema
->tableExists($table)) {
$this
->fail(SafeMarkup::format('Installed entity type table for the %entity_type entity type: %table', array(
'%entity_type' => $entity_type_id,
'%table' => $table,
)));
$all_tables_exist = FALSE;
}
}
if ($all_tables_exist) {
$this
->pass(SafeMarkup::format('Installed entity type tables for the %entity_type entity type: %tables', array(
'%entity_type' => $entity_type_id,
'%tables' => '{' . implode('}, {', $tables) . '}',
)));
}
}
}