public function DateRecurOccurrenceTableTest::testTableCreateDeleteOnFieldStorageCreate in Recurring Dates Field 8
Ensure occurrence table is created and deleted for field storage entities.
File
- tests/
src/ Kernel/ DateRecurOccurrenceTableTest.php, line 39
Class
- DateRecurOccurrenceTableTest
- Tests occurrence tables.
Namespace
Drupal\Tests\date_recur\KernelCode
public function testTableCreateDeleteOnFieldStorageCreate() {
$tableName = 'date_recur__entity_test__abc';
$actualExists = $this->container
->get('database')
->schema()
->tableExists($tableName);
$this
->assertFalse($actualExists);
$fieldStorage = FieldStorageConfig::create([
'entity_type' => 'entity_test',
'field_name' => 'abc',
'type' => 'date_recur',
'settings' => [
'datetime_type' => DateRecurItem::DATETIME_TYPE_DATETIME,
'occurrence_handler_plugin' => 'date_recur_occurrence_handler',
],
]);
$fieldStorage
->save();
$actualExists = $this->container
->get('database')
->schema()
->tableExists($tableName);
$this
->assertTrue($actualExists);
$fieldStorage
->delete();
$actualExists = $this->container
->get('database')
->schema()
->tableExists($tableName);
$this
->assertFalse($actualExists);
}