protected function ConditionalFieldEntityReferenceTest::setUp in Conditional Fields 8
Same name and namespace in other branches
- 4.x tests/src/FunctionalJavascript/ConditionalFieldEntityReferenceTest.php \Drupal\Tests\conditional_fields\FunctionalJavascript\ConditionalFieldEntityReferenceTest::setUp()
Overrides ConditionalFieldTestBase::setUp
File
- tests/
src/ FunctionalJavascript/ ConditionalFieldEntityReferenceTest.php, line 78
Class
- ConditionalFieldEntityReferenceTest
- Test Conditional Fields Entity Reference Plugin.
Namespace
Drupal\Tests\conditional_fields\FunctionalJavascriptCode
protected function setUp() {
parent::setUp();
$this->fieldSelector = '[name="field_' . $this->fieldName . '[0][target_id]"]';
$handler_settings = [
'target_bundles' => [
'article' => 'article',
],
];
$this
->createEntityReferenceField('node', 'article', 'field_' . $this->fieldName, $this->fieldName, 'node', 'default', $handler_settings, -1);
EntityFormDisplay::load('node.article.default')
->setComponent('field_' . $this->fieldName, [
'type' => 'entity_reference_autocomplete',
])
->save();
}