diff --git a/phpunit.xml b/phpunit.xml index cb1f4fd..6c8d556 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -3,11 +3,9 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" - forceCoversAnnotation="true" - beStrictAboutCoversAnnotation="true" + requireCoverageMetadata="true" + beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" - beStrictAboutTodoAnnotatedTests="true" - convertDeprecationsToExceptions="true" stopOnFailure="false" cacheDirectory=".phpunit.cache" > diff --git a/tests/ConfigFactoryTest.php b/tests/ConfigFactoryTest.php index 42d33f1..20afab6 100644 --- a/tests/ConfigFactoryTest.php +++ b/tests/ConfigFactoryTest.php @@ -2,7 +2,9 @@ namespace Tests; +use L5Swagger\ConfigFactory; use L5Swagger\Exceptions\L5SwaggerException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\TestDox; @@ -10,6 +12,7 @@ * @covers \L5Swagger\ConfigFactory */ #[TestDox('Configuration factory')] +#[CoversClass(ConfigFactory::class)] class ConfigFactoryTest extends TestCase { public function testItThrowsExceptionIfDocumentationConfigNotFound(): void diff --git a/tests/ConsoleTest.php b/tests/ConsoleTest.php index ce68974..579058c 100644 --- a/tests/ConsoleTest.php +++ b/tests/ConsoleTest.php @@ -5,7 +5,9 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Facades\Artisan; +use L5Swagger\Console\GenerateDocsCommand; use L5Swagger\Exceptions\L5SwaggerException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\TestDox; @@ -13,6 +15,7 @@ * @covers \L5Swagger\Console\GenerateDocsCommand */ #[TestDox('Console commands')] +#[CoversClass(GenerateDocsCommand::class)] class ConsoleTest extends TestCase { /** diff --git a/tests/GeneratorTest.php b/tests/GeneratorTest.php index 4afcd8b..539b9f0 100644 --- a/tests/GeneratorTest.php +++ b/tests/GeneratorTest.php @@ -4,8 +4,10 @@ use Illuminate\Http\Request; use L5Swagger\Exceptions\L5SwaggerException; +use L5Swagger\Generator; use OpenApi\Analysers\TokenAnalyser; use OpenApi\Processors\CleanUnmerged; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\TestDox; use Symfony\Component\Yaml\Parser; use Symfony\Component\Yaml\Yaml; @@ -14,6 +16,7 @@ * @covers \L5Swagger\Generator */ #[TestDox('Generator')] +#[CoversClass(Generator::class)] class GeneratorTest extends TestCase { /** diff --git a/tests/HelpersTest.php b/tests/HelpersTest.php index 7030ebb..ff60582 100644 --- a/tests/HelpersTest.php +++ b/tests/HelpersTest.php @@ -3,12 +3,15 @@ namespace Tests; use L5Swagger\Exceptions\L5SwaggerException; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\CoversFunction; use PHPUnit\Framework\Attributes\TestDox; /** * @covers L5SwaggerException */ #[TestDox('Helpers')] +#[CoversFunction('l5_swagger_asset')] class HelpersTest extends TestCase { public function testAssetFunctionThrowsExceptionIfFileDoesNotExists(): void diff --git a/tests/RoutesTest.php b/tests/RoutesTest.php index 5febde6..fb8db8c 100644 --- a/tests/RoutesTest.php +++ b/tests/RoutesTest.php @@ -5,6 +5,9 @@ use L5Swagger\Exceptions\L5SwaggerException; use L5Swagger\Generator; use L5Swagger\GeneratorFactory; +use L5Swagger\Http\Controllers\SwaggerAssetController; +use L5Swagger\Http\Controllers\SwaggerController; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\MockObject\Exception; @@ -13,6 +16,8 @@ * @covers \L5Swagger\Http\Controllers\SwaggerAssetController */ #[TestDox('Routes')] +#[CoversClass(SwaggerController::class)] +#[CoversClass(SwaggerAssetController::class)] class RoutesTest extends TestCase { public function testUserCantAccessJsonFileIfItIsNotGenerated(): void diff --git a/tests/SecurityDefinitionsTest.php b/tests/SecurityDefinitionsTest.php index ebd17a7..b7ffc59 100644 --- a/tests/SecurityDefinitionsTest.php +++ b/tests/SecurityDefinitionsTest.php @@ -4,6 +4,8 @@ use Illuminate\Filesystem\Filesystem; use L5Swagger\Exceptions\L5SwaggerException; +use L5Swagger\SecurityDefinitions; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\TestDox; @@ -11,6 +13,7 @@ * @covers \L5Swagger\SecurityDefinitions */ #[TestDox('Security definition')] +#[CoversClass(SecurityDefinitions::class)] class SecurityDefinitionsTest extends TestCase { /**