From 95d84f354d2402e7e0dc6a57bcfec6591abcf20c Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 9 Aug 2022 19:48:43 +0200 Subject: [PATCH] Simplified tests config --- composer.json | 4 ++-- config/test/test_config.global.php | 18 +++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 6a91dd85..36ee6ab5 100644 --- a/composer.json +++ b/composer.json @@ -107,7 +107,7 @@ ], "ci:parallel": [ "@parallel cs stan swagger:validate test:unit:ci test:db:sqlite:ci test:db:mysql test:db:maria test:db:postgres test:db:ms", - "@parallel infect:test:api infect:ci:unit infect:ci:db" + "@parallel infect:test:api infect:test:cli infect:ci:unit infect:ci:db" ], "cs": "phpcs", "cs:fix": "phpcbf", @@ -143,7 +143,7 @@ "infect:ci:db": "@infect:ci:base --coverage=build/coverage-db --min-msi=95 --configuration=infection-db.json", "infect:ci:api": "@infect:ci:base --coverage=build/coverage-api --min-msi=80 --configuration=infection-api.json", "infect:ci:cli": "@infect:ci:base --coverage=build/coverage-cli --min-msi=95 --configuration=infection-cli.json", - "infect:ci": "@parallel infect:ci:unit infect:ci:db infect:ci:api", + "infect:ci": "@parallel infect:ci:unit infect:ci:db infect:ci:api infect:ci:cli", "infect:test": [ "@parallel test:unit:ci test:db:sqlite:ci test:api:ci", "@infect:ci" diff --git a/config/test/test_config.global.php b/config/test/test_config.global.php index ddd7631d..75dd7457 100644 --- a/config/test/test_config.global.php +++ b/config/test/test_config.global.php @@ -9,7 +9,6 @@ use Laminas\ConfigAggregator\ConfigAggregator; use Laminas\Diactoros\Response\EmptyResponse; use Laminas\ServiceManager\Factory\InvokableFactory; use League\Event\EventDispatcher; -use Monolog\Handler\StreamHandler; use Monolog\Level; use PHPUnit\Runner\Version; use Psr\Container\ContainerInterface; @@ -22,11 +21,11 @@ use SebastianBergmann\CodeCoverage\Filter; use SebastianBergmann\CodeCoverage\Report\Html\Facade as Html; use SebastianBergmann\CodeCoverage\Report\PHP; use SebastianBergmann\CodeCoverage\Report\Xml\Facade as Xml; +use Shlinkio\Shlink\Common\Logger\LoggerType; use Symfony\Component\Console\Application; use Symfony\Component\Console\Event\ConsoleCommandEvent; use Symfony\Component\Console\Event\ConsoleTerminateEvent; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -use Shlinkio\Shlink\Common\Logger\LoggerType; use function Laminas\Stratigility\middleware; use function Shlinkio\Shlink\Config\env; @@ -51,23 +50,16 @@ if ($isE2eTest && $generateCoverage) { /** * @param 'api'|'cli' $type - * @param array<'cov'|'xml'|'html'> $formats */ -$exportCoverage = static function (string $type = 'api', array $formats = ['cov', 'xml', 'html']) use (&$coverage): void { +$exportCoverage = static function (string $type = 'api') use (&$coverage): void { if ($coverage === null) { return; } $basePath = __DIR__ . '/../../build/coverage-' . $type; - - foreach ($formats as $format) { - match ($format) { - 'cov' => (new PHP())->process($coverage, $basePath . '.cov'), - 'xml' => (new Xml(Version::getVersionString()))->process($coverage, $basePath . '/coverage-xml'), - 'html' => (new Html())->process($coverage, $basePath . '/coverage-html'), - default => null, - }; - } + (new PHP())->process($coverage, $basePath . '.cov'); + (new Xml(Version::getVersionString()))->process($coverage, $basePath . '/coverage-xml'); + (new Html())->process($coverage, $basePath . '/coverage-html'); }; $buildDbConnection = static function (): array {