protected function BooleanItemTest::setUp in Drupal 10        
                          
                  
                        Same name and namespace in other branches
- 8 core/modules/field/tests/src/Kernel/Boolean/BooleanItemTest.php \Drupal\Tests\field\Kernel\Boolean\BooleanItemTest::setUp()
- 9 core/modules/field/tests/src/Kernel/Boolean/BooleanItemTest.php \Drupal\Tests\field\Kernel\Boolean\BooleanItemTest::setUp()
File
 
   - core/modules/field/tests/src/Kernel/Boolean/BooleanItemTest.php, line 22
Class
  
  - BooleanItemTest 
- Tests the new entity API for the boolean field type.
Namespace
  Drupal\Tests\field\Kernel\Boolean
Code
protected function setUp() : void {
  parent::setUp();
  
  FieldStorageConfig::create([
    'field_name' => 'field_boolean',
    'entity_type' => 'entity_test',
    'type' => 'boolean',
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_boolean',
    'bundle' => 'entity_test',
  ])
    ->save();
  
  \Drupal::service('entity_display.repository')
    ->getFormDisplay('entity_test', 'entity_test')
    ->setComponent('field_boolean', [
    'type' => 'boolean_checkbox',
  ])
    ->save();
}