You are here

protected function ColorFieldFunctionalTestBase::setUp in Color Field 8.2

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ColorFieldFunctionalTestBase.php, line 49

Class

ColorFieldFunctionalTestBase
Provide basic setup for all color field functional tests.

Namespace

Drupal\Tests\color_field\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalCreateContentType([
    'type' => 'article',
  ]);
  $user = $this
    ->drupalCreateUser([
    'create article content',
    'edit own article content',
  ]);
  $this
    ->drupalLogin($user);
  $entityTypeManager = $this->container
    ->get('entity_type.manager');
  FieldStorageConfig::create([
    'field_name' => 'field_color',
    'entity_type' => 'node',
    'type' => 'color_field_type',
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_color',
    'label' => 'Freeform Color',
    'description' => 'Color field description',
    'entity_type' => 'node',
    'bundle' => 'article',
  ])
    ->save();
  $this->form = $entityTypeManager
    ->getStorage('entity_form_display')
    ->load('node.article.default');
  $this->display = $entityTypeManager
    ->getStorage('entity_view_display')
    ->load('node.article.default');
}