protected function MissingEntityReferenceTest::setUp in Entity Share 8.3
Same name and namespace in other branches
- 8.2 modules/entity_share_client/tests/src/Functional/MissingEntityReferenceTest.php \Drupal\Tests\entity_share_client\Functional\MissingEntityReferenceTest::setUp()
Overrides EntityShareClientFunctionalTestBase::setUp
File
- modules/
entity_share_client/ tests/ src/ Functional/ MissingEntityReferenceTest.php, line 35
Class
- MissingEntityReferenceTest
- Functional test class for entity reference field with missing entity.
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function setUp() : void {
parent::setUp();
$node_storage = $this->entityTypeManager
->getStorage('node');
$term_storage = $this->entityTypeManager
->getStorage('taxonomy_term');
// Create a node that will be referenced.
$node_to_be_referenced = $node_storage
->create([
'uuid' => 'es_test_to_be_deleted',
'langcode' => 'en',
'type' => 'es_test',
'title' => $this
->randomString(),
]);
$node_to_be_referenced
->save();
// Create a term that will be referenced.
$term_to_be_referenced = $term_storage
->create([
'uuid' => 'es_test_tag_deleted',
'langcode' => 'en',
'vid' => 'es_test',
'name' => $this
->randomString(),
]);
$term_to_be_referenced
->save();
$this
->prepareContent();
// Delete the node and term before populating the request service otherwise
// the remote website emulation won't be ok.
$node_to_be_referenced
->delete();
$term_to_be_referenced
->delete();
$this
->populateRequestService();
$this
->deleteContent();
}