Added infection to the build matrix

This commit is contained in:
Alejandro Celaya
2018-03-26 17:09:50 +02:00
parent d0df007812
commit f788d6872f
5 changed files with 35 additions and 13 deletions

View File

@@ -47,6 +47,7 @@
},
"require-dev": {
"filp/whoops": "^2.0",
"infection/infection": "^0.8.1",
"phpstan/phpstan": "0.9",
"phpunit/dbunit": "^3.0",
"phpunit/phpcov": "^4.0",
@@ -87,7 +88,8 @@
"@cs",
"@stan",
"@test",
"@func-test"
"@func-test",
"@infect"
],
"cs": "phpcs",
"cs-fix": "phpcbf",
@@ -100,7 +102,8 @@
"@func-test",
"phpcov merge build --html build/html"
],
"stan": "phpstan analyse module/*/src/ --level=6 -c phpstan.neon"
"stan": "phpstan analyse module/*/src/ --level=6 -c phpstan.neon",
"infect": "infection --threads=4 --min-msi=65 --only-covered --log-verbosity=2"
},
"config": {
"process-timeout": 0,

18
infection.json Normal file
View File

@@ -0,0 +1,18 @@
{
"source": {
"directories": [
"module/*/src"
],
"excludes": []
},
"timeout": 10,
"logs": {
"text": "build/infection/infection-log.txt",
"summary": "build/infection/summary-log.txt",
"debug": "build/infection/debug-log.txt"
},
"tmpDir": "build/infection/temp",
"phpUnit": {
"configDir": "."
}
}

View File

@@ -20,7 +20,7 @@ class JsonErrorResponseGenerator implements ErrorResponseGeneratorInterface, Sta
* @return Response
* @throws \InvalidArgumentException
*/
public function __invoke($e, Request $request, Response $response)
public function __invoke(?\Throwable $e, Request $request, Response $response)
{
$status = $response->getStatusCode();
$responsePhrase = $status < 400 ? 'Internal Server Error' : $response->getReasonPhrase();

View File

@@ -9,16 +9,16 @@ use Shlinkio\Shlink\Rest\Exception as Rest;
class RestUtils
{
const INVALID_SHORTCODE_ERROR = 'INVALID_SHORTCODE';
const INVALID_URL_ERROR = 'INVALID_URL';
const INVALID_ARGUMENT_ERROR = 'INVALID_ARGUMENT';
const INVALID_SLUG_ERROR = 'INVALID_SLUG';
const INVALID_CREDENTIALS_ERROR = 'INVALID_CREDENTIALS';
const INVALID_AUTH_TOKEN_ERROR = 'INVALID_AUTH_TOKEN';
const INVALID_AUTHORIZATION_ERROR = 'INVALID_AUTHORIZATION';
const INVALID_API_KEY_ERROR = 'INVALID_API_KEY';
const NOT_FOUND_ERROR = 'NOT_FOUND';
const UNKNOWN_ERROR = 'UNKNOWN_ERROR';
public const INVALID_SHORTCODE_ERROR = 'INVALID_SHORTCODE';
public const INVALID_URL_ERROR = 'INVALID_URL';
public const INVALID_ARGUMENT_ERROR = 'INVALID_ARGUMENT';
public const INVALID_SLUG_ERROR = 'INVALID_SLUG';
public const INVALID_CREDENTIALS_ERROR = 'INVALID_CREDENTIALS';
public const INVALID_AUTH_TOKEN_ERROR = 'INVALID_AUTH_TOKEN';
public const INVALID_AUTHORIZATION_ERROR = 'INVALID_AUTHORIZATION';
public const INVALID_API_KEY_ERROR = 'INVALID_API_KEY';
public const NOT_FOUND_ERROR = 'NOT_FOUND';
public const UNKNOWN_ERROR = 'UNKNOWN_ERROR';
public static function getRestErrorCodeFromException(\Throwable $e)
{

View File

@@ -1,3 +1,4 @@
parameters:
excludes_analyse:
- module/Common/src/Template/Extension/TranslatorExtension.php
- module/Rest/src/Util/RestUtils.php