function ResourceTestBase::refreshTestStateAfterRestConfigChange

Same name in other branches
  1. 8.9.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::refreshTestStateAfterRestConfigChange()
  2. 10 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::refreshTestStateAfterRestConfigChange()
  3. 11.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::refreshTestStateAfterRestConfigChange()

Refreshes the state of the tester to be in sync with the testee.

Should be called after every change made to:

  • RestResourceConfig entities
9 calls to ResourceTestBase::refreshTestStateAfterRestConfigChange()
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.
FileUploadResourceTestBase::setUp in core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
FileUploadResourceTestBase::testFileUploadLargerFileSize in core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
Tests using the file upload route with a file size larger than allowed.
FileUploadResourceTestBase::testFileUploadMaliciousExtension in core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
Tests using the file upload POST route with malicious extensions.
FileUploadResourceTestBase::testFileUploadNoExtensionSetting in core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
Tests using the file upload POST route no extension configured.

... See full list

File

core/modules/rest/tests/src/Functional/ResourceTestBase.php, line 169

Class

ResourceTestBase
Subclass this for every REST resource, every format and every auth provider.

Namespace

Drupal\Tests\rest\Functional

Code

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 the test generates routes using an
    // up-to-date router.
    \Drupal::service('router.builder')->rebuildIfNeeded();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.