You are here

protected function RESTTestBase::loadEntityFromLocationHeader in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/rest/src/Tests/RESTTestBase.php \Drupal\rest\Tests\RESTTestBase::loadEntityFromLocationHeader()

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.

2 calls to RESTTestBase::loadEntityFromLocationHeader()
CsrfTest::testBasicAuth in core/modules/rest/src/Tests/CsrfTest.php
Tests that CSRF check is not triggered for Basic Auth requests.
CsrfTest::testCookieAuth in core/modules/rest/src/Tests/CsrfTest.php
Tests that CSRF check is triggered for Cookie Auth requests.

File

core/modules/rest/src/Tests/RESTTestBase.php, line 369
Contains \Drupal\rest\Tests\RESTTestBase.

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 entity_load($this->testEntityType, $id);
}