function SelectionTest::setUp
Same name in this branch
- 8.9.x core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Kernel\EntityReference\Views\SelectionTest::setUp()
Same name in other branches
- 9 core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Kernel\EntityReference\Views\SelectionTest::setUp()
- 9 core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Functional\EntityReference\Views\SelectionTest::setUp()
- 10 core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Kernel\EntityReference\Views\SelectionTest::setUp()
- 10 core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Functional\EntityReference\Views\SelectionTest::setUp()
- 11.x core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Kernel\EntityReference\Views\SelectionTest::setUp()
- 11.x core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Functional\EntityReference\Views\SelectionTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ field/ tests/ src/ Functional/ EntityReference/ Views/ SelectionTest.php, line 54
Class
- SelectionTest
- Tests entity reference selection handler.
Namespace
Drupal\Tests\field\Functional\EntityReference\ViewsCode
protected function setUp() {
parent::setUp();
// Create content types and nodes.
$type1 = $this->drupalCreateContentType()
->id();
$type2 = $this->drupalCreateContentType()
->id();
// Add some characters that should be escaped but not double escaped.
$node1 = $this->drupalCreateNode([
'type' => $type1,
'title' => 'Test first node &<>',
]);
$node2 = $this->drupalCreateNode([
'type' => $type1,
'title' => 'Test second node &&&',
]);
$node3 = $this->drupalCreateNode([
'type' => $type2,
'title' => 'Test third node <span />',
]);
foreach ([
$node1,
$node2,
$node3,
] as $node) {
$this->nodes[$node->id()] = $node;
}
// Create an entity reference field.
$handler_settings = [
'view' => [
'view_name' => 'test_entity_reference',
'display_name' => 'entity_reference_1',
],
];
$this->handlerSettings = $handler_settings;
$this->createEntityReferenceField('entity_test', 'test_bundle', 'test_field', $this->randomString(), 'node', 'views', $handler_settings);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.