protected function DateRecurViewsFieldAttachedTest::setUp in Recurring Dates Field 3.1.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/DateRecurViewsFieldAttachedTest.php \Drupal\Tests\date_recur\Kernel\DateRecurViewsFieldAttachedTest::setUp()
- 3.x tests/src/Kernel/DateRecurViewsFieldAttachedTest.php \Drupal\Tests\date_recur\Kernel\DateRecurViewsFieldAttachedTest::setUp()
- 3.0.x tests/src/Kernel/DateRecurViewsFieldAttachedTest.php \Drupal\Tests\date_recur\Kernel\DateRecurViewsFieldAttachedTest::setUp()
Parameters
bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.
Overrides DateRecurViewsFieldTest::setUp
File
- tests/
src/ Kernel/ DateRecurViewsFieldAttachedTest.php, line 29
Class
- DateRecurViewsFieldAttachedTest
- Tests the results of 'date_recur_date' field plugin.
Namespace
Drupal\Tests\date_recur\KernelCode
protected function setUp($import_test_views = TRUE) {
parent::setUp(FALSE);
// This is the name of the attached field.
$this->fieldName = 'dr_attached';
$fieldStorage = FieldStorageConfig::create([
'entity_type' => 'dr_entity_test',
'field_name' => $this->fieldName,
'type' => 'date_recur',
'settings' => [
'datetime_type' => DateRecurItem::DATETIME_TYPE_DATETIME,
],
]);
$fieldStorage
->save();
$field = [
'field_name' => $this->fieldName,
'entity_type' => 'dr_entity_test',
'bundle' => 'dr_entity_test',
];
FieldConfig::create($field)
->save();
\Drupal::service('entity_field.manager')
->clearCachedFieldDefinitions();
\Drupal::service('entity_type.manager')
->clearCachedDefinitions();
}