.../EntityResource/EntityResourceTestBase.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index edd5a0f..c72f065 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -147,6 +147,15 @@ protected function provisionEntityResource() { } /** + * Deprovisions the tested entity resource. + */ + protected function deprovisionEntityResource() { + $this->resourceConfigStorage->load('entity.' . static::$entityTypeId) + ->delete(); + $this->refreshTestStateAfterRestConfigChange(); + } + + /** * {@inheritdoc} */ public function setUp() { @@ -410,6 +419,15 @@ public function testGet() { $this->assertResourceResponse(200, FALSE, $response); + $this->deprovisionEntityResource(); + + + // DX: upon deprovisioning, immediate 404, or 403 if canonical route. + $response = $this->request('GET', $url, $request_options); + $this->assertSame($has_canonical_url ? 403 : 404, $response->getStatusCode()); + + + $this->provisionEntityResource(); $url->setOption('query', ['_format' => 'non_existing_format']);