protected function InfiniteLoopTest::prepareContent in Entity Share 8.2
Same name and namespace in other branches
- 8.3 modules/entity_share_client/tests/src/Functional/InfiniteLoopTest.php \Drupal\Tests\entity_share_client\Functional\InfiniteLoopTest::prepareContent()
Helper function to create the content required for the tests.
Overrides EntityShareClientFunctionalTestBase::prepareContent
File
- modules/
entity_share_client/ tests/ src/ Functional/ InfiniteLoopTest.php, line 45
Class
- InfiniteLoopTest
- Functional test class for content entity reference field.
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function prepareContent() {
/** @var \Drupal\node\NodeStorageInterface $node_storage */
$node_storage = $this->entityTypeManager
->getStorage('node');
$node_1 = $node_storage
->create([
'uuid' => 'es_test_content_reference_one',
'type' => static::$entityBundleId,
'title' => $this
->randomString(),
'status' => NodeInterface::PUBLISHED,
]);
$node_1
->save();
$node_2 = $node_storage
->create([
'uuid' => 'es_test_content_reference_two',
'type' => static::$entityBundleId,
'title' => $this
->randomString(),
'status' => NodeInterface::PUBLISHED,
'field_es_test_content_reference' => $node_1
->id(),
]);
$node_2
->save();
$node_1
->set('field_es_test_content_reference', $node_2
->id());
$node_1
->save();
$this->entities = [
'node' => [
'es_test_content_reference_one' => $node_1,
'es_test_content_reference_two' => $node_2,
],
];
}