You are here

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

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

Overrides ConditionalFieldTestBase::setUp

File

tests/src/FunctionalJavascript/ConditionalFieldTextTextareaTest.php, line 82

Class

ConditionalFieldTextTextareaTest
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->targetFieldWrapp = '.field--name-' . str_replace('_', '-', $this->targetFieldName);
  $this->fieldStorageDefinition = [
    'field_name' => 'field_' . $this->fieldName,
    'entity_type' => 'node',
    'type' => 'text_long',
    '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',
  ])
    ->save();
}