Same name and namespace in other branches
  1. 8.x-2.x tests/src/Kernel/ColorFieldTypeTest.php \Drupal\Tests\color_field\Kernel\ColorFieldTypeTest::setUp() 1 comment

File

tests/src/Kernel/ColorFieldTypeTest.php, line 81

Class

ColorFieldTypeTest
Tests the new entity API for the color field type.

Namespace

Drupal\Tests\color_field\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    // Create a color field storage and field for validation.
    FieldStorageConfig::create([
        'field_name' => 'field_test',
        'entity_type' => 'entity_test',
        'type' => 'color_field_type',
    ])->save();
    FieldConfig::create([
        'entity_type' => 'entity_test',
        'field_name' => 'field_test',
        'bundle' => 'entity_test',
    ])->save();
    // Create a second field with different options.
    FieldStorageConfig::create([
        'field_name' => 'field_hex',
        'entity_type' => 'entity_test',
        'type' => 'color_field_type',
        'settings' => [
            'format' => 'hexhex',
        ],
    ])->save();
    FieldConfig::create([
        'entity_type' => 'entity_test',
        'field_name' => 'field_hex',
        'bundle' => 'entity_test',
        'settings' => [
            'opacity' => FALSE,
        ],
    ])->save();
}