You are here

public function SwaggerUiLibraryDiscoveryTest::testWithValidLibraryDirectoryColdCache in Swagger UI Field Formatter 8.3

Tests valid library directory with cold cache.

File

tests/src/Unit/SwaggerUiLibraryDiscoveryTest.php, line 96

Class

SwaggerUiLibraryDiscoveryTest
Tests the Swagger UI library discovery service.

Namespace

Drupal\Tests\swagger_ui_formatter\Unit

Code

public function testWithValidLibraryDirectoryColdCache() : void {
  $this
    ->setUpLibraryDirectoryTest();
  $default_theme = new ActiveTheme([
    'name' => 'bartik',
  ]);
  $this->themeManager
    ->expects($this
    ->once())
    ->method('alterForTheme')
    ->with($default_theme, 'swagger_ui_library_directory', self::DEFAULT_LIBRARY_DIR)
    ->willReturn(NULL);

  // Here, we don't care about whether the data has been cached or not.
  $this->cache
    ->expects($this
    ->once())
    ->method('set')
    ->willReturn(NULL);
  self::assertEquals(self::DEFAULT_LIBRARY_DIR, $this->swaggerUiLibraryDiscovery
    ->libraryDirectory());
}