You are here

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

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

Overrides ConditionalFieldTestBase::setUp

File

tests/src/FunctionalJavascript/ConditionalFieldEmailTest.php, line 79

Class

ConditionalFieldEmailTest
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]"]';
  FieldStorageConfig::create([
    'field_name' => 'field_' . $this->fieldName,
    'entity_type' => 'node',
    'type' => 'email',
    'cardinality' => 1,
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_' . $this->fieldName,
    'entity_type' => 'node',
    'bundle' => 'article',
    'settings' => [
      'min' => '',
      'max' => '',
      'prefix' => '',
    ],
  ])
    ->save();
  EntityFormDisplay::load('node.article.default')
    ->setComponent('field_' . $this->fieldName, [
    'type' => 'email_default',
    'settings' => [
      'prefix_suffix' => FALSE,
    ],
  ])
    ->save();
}