protected function EntityShareServerFunctionalTest::checkEntitiesOrderOnChannel in Entity Share 8.2
Same name and namespace in other branches
- 8.3 modules/entity_share_server/tests/src/Functional/EntityShareServerFunctionalTest.php \Drupal\Tests\entity_share_server\Functional\EntityShareServerFunctionalTest::checkEntitiesOrderOnChannel()
Helper function to check the order of entities on a specific channel.
Parameters
string $channel_id: The channel id on which to check the entities.
array $entity_uuids: The entity UUIDs to check for.
1 call to EntityShareServerFunctionalTest::checkEntitiesOrderOnChannel()
- EntityShareServerFunctionalTest::testFilteringAndSortingOnChannel in modules/
entity_share_server/ tests/ src/ Functional/ EntityShareServerFunctionalTest.php - Test filters, groups of filters, and sorts.
File
- modules/
entity_share_server/ tests/ src/ Functional/ EntityShareServerFunctionalTest.php, line 789
Class
- EntityShareServerFunctionalTest
- General functional test class.
Namespace
Drupal\Tests\entity_share_server\FunctionalCode
protected function checkEntitiesOrderOnChannel($channel_id, array $entity_uuids) {
$entity_share_entrypoint_url = Url::fromRoute('entity_share_server.resource_list');
$response = $this
->request('GET', $entity_share_entrypoint_url, $this
->getAuthenticationRequestOptions($this->channelUser));
$entity_share_endpoint_response = Json::decode((string) $response
->getBody());
// Test that the node can be found on the channel URL.
$response = $this
->request('GET', Url::fromUri($entity_share_endpoint_response['data']['channels'][$channel_id]['url']), $this
->getAuthenticationRequestOptions($this->channelUser));
$channel_url_response = Json::decode((string) $response
->getBody());
$channel_url_data = EntityShareUtility::prepareData($channel_url_response['data']);
foreach ($entity_uuids as $entity_position => $entity_uuid) {
$found = FALSE;
if ($channel_url_data[$entity_position]['id'] == $entity_uuid) {
$found = TRUE;
}
$this
->assertTrue($found, 'Correct expected position for entity with UUID: ' . $entity_uuid);
}
}