function EntityResourceTestBase::getEntityResourceUrl
Same name in other branches
- 9 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getEntityResourceUrl()
- 8.9.x core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getEntityResourceUrl()
- 11.x core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getEntityResourceUrl()
Gets an entity resource's GET/PATCH/DELETE URL.
Return value
\Drupal\Core\Url The URL to GET/PATCH/DELETE.
5 calls to EntityResourceTestBase::getEntityResourceUrl()
- EntityResourceTestBase::testDelete in core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php - Tests a DELETE request for an entity, plus edge cases to ensure good DX.
- EntityResourceTestBase::testGet in core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php - Tests a GET request for an entity, plus edge cases to ensure good DX.
- EntityResourceTestBase::testPatch in core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php - Tests a PATCH request for an entity, plus edge cases to ensure good DX.
- EntityTestTextItemNormalizerTest::testGetWithFormat in core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Rest/ EntityTestTextItemNormalizerTest.php - Tests GETting an entity with the test text field set to a specific format.
- TermResourceTestBase::testGetTermWithParent in core/
modules/ taxonomy/ tests/ src/ Functional/ Rest/ TermResourceTestBase.php - Tests GETting a term with a parent term other than the default <root> (0).
File
-
core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php, line 1232
Class
- EntityResourceTestBase
- Defines a base class for testing all entity resources.
Namespace
Drupal\Tests\rest\Functional\EntityResourceCode
protected function getEntityResourceUrl() {
$has_canonical_url = $this->entity
->hasLinkTemplate('canonical');
// Note that the 'canonical' link relation type must be specified explicitly
// in the call to ::toUrl(). 'canonical' is the default for
// \Drupal\Core\Entity\Entity::toUrl(), but ConfigEntityBase overrides this.
return $has_canonical_url ? $this->entity
->toUrl('canonical') : Url::fromUri('base:entity/' . static::$entityTypeId . '/' . $this->entity
->id());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.