.../Functional/EntityResource/EntityResourceTestBase.php | 8 ++++---- .../modules/rest/tests/src/Functional/ResourceTestBase.php | 14 ++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 74a4b42..f9c4579 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -393,7 +393,7 @@ public function testGet() { $this->config('rest.settings')->set('bc_entity_resource_permissions', TRUE)->save(TRUE); - $this->refreshTestStateAfterRestResourceConfigChange(); + $this->refreshTestStateAfterRestConfigChange(); // DX: 403 when unauthorized. @@ -614,7 +614,7 @@ public function testPost() { $this->config('rest.settings')->set('bc_entity_resource_permissions', TRUE)->save(TRUE); - $this->refreshTestStateAfterRestResourceConfigChange(); + $this->refreshTestStateAfterRestConfigChange(); $request_options[RequestOptions::BODY] = $parseable_valid_request_body_2; @@ -820,7 +820,7 @@ public function testPatch() { $this->config('rest.settings')->set('bc_entity_resource_permissions', TRUE)->save(TRUE); - $this->refreshTestStateAfterRestResourceConfigChange(); + $this->refreshTestStateAfterRestConfigChange(); $request_options[RequestOptions::BODY] = $parseable_valid_request_body_2; @@ -918,7 +918,7 @@ public function testDelete() { $this->config('rest.settings')->set('bc_entity_resource_permissions', TRUE)->save(TRUE); - $this->refreshTestStateAfterRestResourceConfigChange(); + $this->refreshTestStateAfterRestConfigChange(); $this->entity = $this->createEntity(); $url = $this->getUrl()->setOption('query', $url->getOption('query')); diff --git a/core/modules/rest/tests/src/Functional/ResourceTestBase.php b/core/modules/rest/tests/src/Functional/ResourceTestBase.php index 4f435c0..39537a9 100644 --- a/core/modules/rest/tests/src/Functional/ResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/ResourceTestBase.php @@ -119,7 +119,7 @@ public function setUp() { // Ensure there's a clean slate: delete all REST resource config entities. $this->resourceConfigStorage->delete($this->resourceConfigStorage->loadMultiple()); - $this->refreshTestStateAfterRestResourceConfigChange(); + $this->refreshTestStateAfterRestConfigChange(); } /** @@ -142,22 +142,24 @@ protected function provisionResource($resource_type, $formats = [], $authenticat 'authentication' => $authentication, ] ])->save(); - $this->refreshTestStateAfterRestResourceConfigChange(); + $this->refreshTestStateAfterRestConfigChange(); } /** * Refreshes the state of the tester to be in sync with the testee. * - * Should be called after every RestResourceConfig entity change. + * Should be called after every change made to: + * - RestResourceConfig entities + * - the 'rest.settings' simple configuration */ - protected function refreshTestStateAfterRestResourceConfigChange() { + protected function refreshTestStateAfterRestConfigChange() { // Ensure that the cache tags invalidator has its internal values reset. // Otherwise the http_response cache tag invalidation won't work. $this->refreshVariables(); // Tests using this base class may trigger route rebuilds due to changes to - // RestResourceConfig entities. Ensure we generate routes using an - // up-to-date router. + // RestResourceConfig entities or 'rest.settings'. Ensure the test generates + // routes using an up-to-date router. \Drupal::service('router.builder')->rebuildIfNeeded(); }