protected function CliTest::populateRequestService in Entity Share 8.2
Helper function to populate the request service with responses.
Overrides EntityShareClientFunctionalTestBase::populateRequestService
File
- modules/
entity_share_client/ tests/ src/ Functional/ CliTest.php, line 135
Class
- CliTest
- General functional test class for CLI integration.
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function populateRequestService() {
parent::populateRequestService();
// Needs to make the requests when only es_test_1 will be required.
$selected_entities = [
'es_test_1',
];
$prepared_url = $this
->prepareUrlFilteredOnUuids($selected_entities, 'node_es_test_en');
$this->jsonapiHelper
->setRemote($this->remote);
$http_client = $this->remoteManager
->prepareJsonApiClient($this->remote);
$this
->discoverJsonApiEndpoints($http_client, $prepared_url);
// Needs to make the requests when both contents will be required.
$selected_entities = [
'es_test_1',
'es_test_2',
];
$prepared_url = $this
->prepareUrlFilteredOnUuids($selected_entities, 'node_es_test_en');
$this->jsonapiHelper
->setRemote($this->remote);
$http_client = $this->remoteManager
->prepareJsonApiClient($this->remote);
$this
->discoverJsonApiEndpoints($http_client, $prepared_url);
// Because of the offset, needs to parse the url_uuid in a special way.
$channel_infos = $this->remoteManager
->getChannelsInfos($this->remote);
$channel_url_uuid = $channel_infos['node_es_test_en']['url_uuid'];
$offset = 0;
$parsed_url = UrlHelper::parse($channel_url_uuid);
$parsed_url['query']['page']['offset'] = $offset;
$query = UrlHelper::buildQuery($parsed_url['query']);
$revisions_url = $parsed_url['path'] . '?' . $query;
$this->jsonapiHelper
->setRemote($this->remote);
$http_client = $this->remoteManager
->prepareJsonApiClient($this->remote);
$this
->discoverJsonApiEndpoints($http_client, $revisions_url);
}