Simplified tests config

This commit is contained in:
Alejandro Celaya 2022-08-09 19:48:43 +02:00
parent db47a9a253
commit 95d84f354d
2 changed files with 7 additions and 15 deletions

View file

@ -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"

View file

@ -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 {