You are here

protected function RESTTestBase::loadEntityFromLocationHeader in Drupal 8

Loads an entity based on the location URL returned in the location header.

Parameters

string $location_url: The URL returned in the Location header.

Return value

\Drupal\Core\Entity\Entity|false The entity or FALSE if there is no matching entity.

File

core/modules/rest/src/Tests/RESTTestBase.php, line 534

Class

RESTTestBase
Test helper class that provides a REST client method to send HTTP requests.

Namespace

Drupal\rest\Tests

Code

protected function loadEntityFromLocationHeader($location_url) {
  $url_parts = explode('/', $location_url);
  $id = end($url_parts);
  return $this->container
    ->get('entity_type.manager')
    ->getStorage($this->testEntityType)
    ->load($id);
}