protected function TimestampFormatterTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field/src/Tests/Timestamp/TimestampFormatterTest.php \Drupal\field\Tests\Timestamp\TimestampFormatterTest::setUp()
Performs setup tasks before each individual test method is run.
Overrides KernelTestBase::setUp
File
- core/
modules/ field/ src/ Tests/ Timestamp/ TimestampFormatterTest.php, line 54 - Contains \Drupal\field\Tests\Timestamp\TimestampFormatterTest.
Class
- TimestampFormatterTest
- Tests the timestamp formatters.
Namespace
Drupal\field\Tests\TimestampCode
protected function setUp() {
parent::setUp();
$this
->installConfig([
'system',
]);
$this
->installConfig([
'field',
]);
$this
->installEntitySchema('entity_test');
$this->entityType = 'entity_test';
$this->bundle = $this->entityType;
$this->fieldName = Unicode::strtolower($this
->randomMachineName());
$field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName,
'entity_type' => $this->entityType,
'type' => 'timestamp',
]);
$field_storage
->save();
$instance = FieldConfig::create([
'field_storage' => $field_storage,
'bundle' => $this->bundle,
'label' => $this
->randomMachineName(),
]);
$instance
->save();
$this->display = entity_get_display($this->entityType, $this->bundle, 'default')
->setComponent($this->fieldName, [
'type' => 'boolean',
'settings' => [],
]);
$this->display
->save();
}