protected function EntityResourceTestBase::getEntityResourceUrl in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getEntityResourceUrl()
- 9 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.
- 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).
- TermResourceTestBase::testPatchPath in core/
modules/ taxonomy/ tests/ src/ Functional/ Rest/ TermResourceTestBase.php - Tests PATCHing a term's path.
File
- core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php, line 1221
Class
- EntityResourceTestBase
- Even though there is the generic EntityResource, it's necessary for every entity type to have its own test, because they each have different fields, validation constraints, et cetera. It's not because the generic case works, that every case…
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());
}