You are here

protected function ConditionalFieldTextWithSummaryTest::setUp in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 tests/src/FunctionalJavascript/ConditionalFieldTextWithSummaryTest.php \Drupal\Tests\conditional_fields\FunctionalJavascript\ConditionalFieldTextWithSummaryTest::setUp()

Overrides ConditionalFieldTestBase::setUp

File

tests/src/FunctionalJavascript/ConditionalFieldTextWithSummaryTest.php, line 68

Class

ConditionalFieldTextWithSummaryTest
Test Conditional Fields Text Handler.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();
  $this->fieldSelector = '[name="field_' . $this->fieldName . '[0][value]"]';
  $this->fieldStorageDefinition = [
    'field_name' => 'field_' . $this->fieldName,
    'entity_type' => 'node',
    'type' => 'text_with_summary',
    'cardinality' => 1,
  ];
  $this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition);
  $this->fieldStorage
    ->save();
  FieldConfig::create([
    'field_name' => 'field_' . $this->fieldName,
    'entity_type' => 'node',
    'bundle' => 'article',
  ])
    ->save();
  EntityFormDisplay::load('node.article.default')
    ->setComponent('field_' . $this->fieldName, [
    'type' => 'text_textarea_with_summary',
  ])
    ->save();
}