You are here

private function SwaggerUiLibraryDiscovery::flushCaches in Swagger UI Field Formatter 8.3

Flushes caches for tests.

2 calls to SwaggerUiLibraryDiscovery::flushCaches()
SwaggerUiLibraryDiscovery::fakeMissingLibrary in tests/modules/swagger_ui_formatter_test/src/Service/SwaggerUiLibraryDiscovery.php
Helper function to fake a missing library path.
SwaggerUiLibraryDiscovery::fakeUnsupportedLibrary in tests/modules/swagger_ui_formatter_test/src/Service/SwaggerUiLibraryDiscovery.php
Helper function to fake an unsupported library version.

File

tests/modules/swagger_ui_formatter_test/src/Service/SwaggerUiLibraryDiscovery.php, line 147

Class

SwaggerUiLibraryDiscovery
Decorator service for testing.

Namespace

Drupal\swagger_ui_formatter_test\Service

Code

private function flushCaches() : void {

  // Invalidate the cache tags so the library path needs to be re-calculated.
  $this->cacheTagsInvalidator
    ->invalidateTags($this
    ->getCacheTags());

  // DrupalWTF, render cache should be invalidated automatically but it seems
  // there is a hidden static state somewhere...
  // @see \Drupal\Tests\swagger_ui_formatter\FunctionalJavascript\SwaggerUiFieldFormatterTest::validateSwaggerUiErrorMessage()
  // @see \Drupal\Core\Test\RefreshVariablesTrait::refreshVariables()
  if ($this->cacheTagsInvalidator instanceof CacheTagsInvalidator) {
    $this->cacheTagsInvalidator
      ->resetChecksums();
  }

  // Flush the static cache of the used service by the
  // SwaggerUIFormatterTrait, this warrants that valid library
  // gets registered when it is needed.
  $this->libraryDiscovery
    ->clearCachedDefinitions();
}