You are here

protected function EmbeddedEntityTest::populateRequestService in Entity Share 8.3

Helper function to populate the request service with responses.

Overrides EntityShareClientFunctionalTestBase::populateRequestService

1 call to EmbeddedEntityTest::populateRequestService()
EmbeddedEntityTest::postSetupFixture in modules/entity_share_client/tests/src/Functional/EmbeddedEntityTest.php
Helper function.

File

modules/entity_share_client/tests/src/Functional/EmbeddedEntityTest.php, line 231

Class

EmbeddedEntityTest
Functional test class for embedded entities in RTE fields.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function populateRequestService() {
  parent::populateRequestService();

  // Needs to make the requests when only the embedded content will be
  // required.
  // Nodes.
  $route_name = sprintf('jsonapi.%s--%s.individual', 'node', 'es_test');
  $linked_content_url = Url::fromRoute($route_name, [
    'entity' => 'es_test_embedded_linkit',
  ])
    ->setOption('language', $this->container
    ->get('language_manager')
    ->getLanguage('en'))
    ->setOption('absolute', TRUE);
  $this
    ->discoverJsonApiEndpoints($linked_content_url
    ->toString());
  $linked_content_url = Url::fromRoute($route_name, [
    'entity' => 'es_test_embedded_entity_embed',
  ])
    ->setOption('language', $this->container
    ->get('language_manager')
    ->getLanguage('en'))
    ->setOption('absolute', TRUE);
  $this
    ->discoverJsonApiEndpoints($linked_content_url
    ->toString());

  // File.
  // File document will be detected with the media.
  $route_name = sprintf('jsonapi.%s--%s.individual', 'file', 'file');
  $linked_content_url = Url::fromRoute($route_name, [
    'entity' => 'file_image',
  ])
    ->setOption('language', $this->container
    ->get('language_manager')
    ->getLanguage('en'))
    ->setOption('absolute', TRUE);
  $this
    ->discoverJsonApiEndpoints($linked_content_url
    ->toString());

  // Media.
  $route_name = sprintf('jsonapi.%s--%s.individual', 'media', 'es_test_document');
  $linked_content_url = Url::fromRoute($route_name, [
    'entity' => 'es_test_document',
  ])
    ->setOption('language', $this->container
    ->get('language_manager')
    ->getLanguage('en'))
    ->setOption('absolute', TRUE);
  $this
    ->discoverJsonApiEndpoints($linked_content_url
    ->toString());
}