protected function BooleanFormatterTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field/src/Tests/Boolean/BooleanFormatterTest.php \Drupal\field\Tests\Boolean\BooleanFormatterTest::setUp()
Performs setup tasks before each individual test method is run.
Overrides KernelTestBase::setUp
File
- core/
modules/ field/ src/ Tests/ Boolean/ BooleanFormatterTest.php, line 55 - Contains \Drupal\field\Tests\Boolean\BooleanFormatterTest.
Class
- BooleanFormatterTest
- Tests the boolean formatter.
Namespace
Drupal\field\Tests\BooleanCode
protected function setUp() {
parent::setUp();
$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' => 'boolean',
]);
$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();
}