You are here

public function TaxonomyEntityReferenceTest::testReferencedEntityCreated in Entity Share 8.2

Same name and namespace in other branches
  1. 8.3 modules/entity_share_client/tests/src/Functional/TaxonomyEntityReferenceTest.php \Drupal\Tests\entity_share_client\Functional\TaxonomyEntityReferenceTest::testReferencedEntityCreated()

Test that a referenced entity is pulled even if not selected.

This test that:

  • an taxonomy entity reference field is working
  • the parent base field on taxonomy entities is working.

File

modules/entity_share_client/tests/src/Functional/TaxonomyEntityReferenceTest.php, line 95

Class

TaxonomyEntityReferenceTest
Functional test class for taxonomy entity reference field.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

public function testReferencedEntityCreated() {

  // Select only the referencing node entity.
  $selected_entities = [
    'es_test_taxonomy_reference',
  ];
  $prepared_url = $this
    ->prepareUrlFilteredOnUuids($selected_entities, 'node_es_test_en');
  $this->jsonapiHelper
    ->setRemote($this->remote);
  $http_client = $this->remoteManager
    ->prepareJsonApiClient($this->remote);
  $response = $this->requestService
    ->request($http_client, 'GET', $prepared_url);
  $json = Json::decode((string) $response
    ->getBody());
  $this->jsonapiHelper
    ->importEntityListData(EntityShareUtility::prepareData($json['data']));
  $this
    ->checkCreatedEntities();
}