You are here

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

Tests with valid library version.

File

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

Class

SwaggerUiLibraryDiscoveryTest
Tests the Swagger UI library discovery service.

Namespace

Drupal\Tests\swagger_ui_formatter\Unit

Code

public function testWithValidLibraryVersion() : void {
  $this
    ->setUpLibraryVersionTest();

  // Imitate that SwaggerUiLibraryDiscovery::libraryDirectory() responds
  // from cache to avoid mocking or different services.
  $this->cache
    ->method('get')
    ->willReturn((object) [
    'data' => self::DEFAULT_LIBRARY_DIR,
  ]);
  self::assertEquals(SWAGGER_UI_FORMATTER_TEST_VALID_LIBRARY_VERSION, $this->swaggerUiLibraryDiscovery
    ->libraryVersion());
}