public function SwaggerUiLibraryDiscoveryTest::testWithMissingPackageJson in Swagger UI Field Formatter 8.3
Tests with missing package.json.
File
- tests/
src/ Unit/ SwaggerUiLibraryDiscoveryTest.php, line 186
Class
- SwaggerUiLibraryDiscoveryTest
- Tests the Swagger UI library discovery service.
Namespace
Drupal\Tests\swagger_ui_formatter\UnitCode
public function testWithMissingPackageJson() : void {
$this
->setUpLibraryVersionTest();
// Imitate a wrong package.json path with a specific library directory.
$this->cache
->method('get')
->willReturn((object) [
'data' => SWAGGER_UI_FORMATTER_TEST_MISSING_PACKAGE_JSON_DIR,
]);
$this
->expectException(SwaggerUiLibraryDiscoveryException::class);
$this
->expectExceptionCode(SwaggerUiLibraryDiscoveryException::CODE_CANNOT_READ_PACKAGE_JSON_CONTENT);
$this->swaggerUiLibraryDiscovery
->libraryVersion();
}