Increased MSI to 61%

This commit is contained in:
Alejandro Celaya 2018-11-17 17:36:22 +01:00
parent 67e465c479
commit a705ef21a9
6 changed files with 41 additions and 13 deletions

View file

@ -125,7 +125,11 @@
"infect": "infection --threads=4 --min-msi=60 --log-verbosity=2 --only-covered", "infect": "infection --threads=4 --min-msi=60 --log-verbosity=2 --only-covered",
"infect:ci": "infection --threads=4 --min-msi=60 --log-verbosity=2 --only-covered --coverage=build", "infect:ci": "infection --threads=4 --min-msi=60 --log-verbosity=2 --only-covered --coverage=build",
"infect:show": "infection --threads=4 --min-msi=60 --log-verbosity=2 --only-covered --show-mutations" "infect:show": "infection --threads=4 --min-msi=60 --log-verbosity=2 --only-covered --show-mutations",
"infect:test": [
"@test:unit:ci",
"@infect:ci"
]
}, },
"scripts-descriptions": { "scripts-descriptions": {
"check": "<fg=blue;options=bold>Alias for \"cs\", \"stan\", \"test\" and \"infect\"</>", "check": "<fg=blue;options=bold>Alias for \"cs\", \"stan\", \"test\" and \"infect\"</>",

View file

@ -4,7 +4,7 @@
"module/*/src" "module/*/src"
] ]
}, },
"timeout": 10, "timeout": 5,
"logs": { "logs": {
"text": "build/infection/infection-log.txt", "text": "build/infection/infection-log.txt",
"summary": "build/infection/summary-log.txt", "summary": "build/infection/summary-log.txt",

View file

@ -57,12 +57,11 @@ class ListKeysCommand extends Command
$enabledOnly = $input->getOption('enabledOnly'); $enabledOnly = $input->getOption('enabledOnly');
$rows = array_map(function (ApiKey $apiKey) use ($enabledOnly) { $rows = array_map(function (ApiKey $apiKey) use ($enabledOnly) {
$key = (string) $apiKey;
$expiration = $apiKey->getExpirationDate(); $expiration = $apiKey->getExpirationDate();
$messagePattern = $this->determineMessagePattern($apiKey); $messagePattern = $this->determineMessagePattern($apiKey);
// Set columns for this row // Set columns for this row
$rowData = [sprintf($messagePattern, $key)]; $rowData = [sprintf($messagePattern, $apiKey)];
if (! $enabledOnly) { if (! $enabledOnly) {
$rowData[] = sprintf($messagePattern, $this->getEnabledSymbol($apiKey)); $rowData[] = sprintf($messagePattern, $this->getEnabledSymbol($apiKey));
} }

View file

@ -39,10 +39,14 @@ class DisableKeyCommandTest extends TestCase
{ {
$apiKey = 'abcd1234'; $apiKey = 'abcd1234';
$this->apiKeyService->disable($apiKey)->shouldBeCalledOnce(); $this->apiKeyService->disable($apiKey)->shouldBeCalledOnce();
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'api-key:disable', 'command' => 'api-key:disable',
'apiKey' => $apiKey, 'apiKey' => $apiKey,
]); ]);
$output = $this->commandTester->getDisplay();
$this->assertContains('API key "abcd1234" properly disabled', $output);
} }
/** /**
@ -51,14 +55,15 @@ class DisableKeyCommandTest extends TestCase
public function errorIsReturnedIfServiceThrowsException() public function errorIsReturnedIfServiceThrowsException()
{ {
$apiKey = 'abcd1234'; $apiKey = 'abcd1234';
$this->apiKeyService->disable($apiKey)->willThrow(InvalidArgumentException::class) $disable = $this->apiKeyService->disable($apiKey)->willThrow(InvalidArgumentException::class);
->shouldBeCalledOnce();
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'api-key:disable', 'command' => 'api-key:disable',
'apiKey' => $apiKey, 'apiKey' => $apiKey,
]); ]);
$output = $this->commandTester->getDisplay(); $output = $this->commandTester->getDisplay();
$this->assertContains('API key "abcd1234" does not exist.', $output); $this->assertContains('API key "abcd1234" does not exist.', $output);
$disable->shouldHaveBeenCalledOnce();
} }
} }

View file

@ -39,11 +39,15 @@ class GenerateKeyCommandTest extends TestCase
*/ */
public function noExpirationDateIsDefinedIfNotProvided() public function noExpirationDateIsDefinedIfNotProvided()
{ {
$this->apiKeyService->create(null)->shouldBeCalledOnce() $create = $this->apiKeyService->create(null)->willReturn(new ApiKey());
->willReturn(new ApiKey());
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'api-key:generate', 'command' => 'api-key:generate',
]); ]);
$output = $this->commandTester->getDisplay();
$this->assertContains('Generated API key: ', $output);
$create->shouldHaveBeenCalledOnce();
} }
/** /**

View file

@ -35,30 +35,46 @@ class ListKeysCommandTest extends TestCase
/** /**
* @test * @test
*/ */
public function ifEnabledOnlyIsNotProvidedEverythingIsListed() public function everythingIsListedIfEnabledOnlyIsNotProvided()
{ {
$this->apiKeyService->listKeys(false)->willReturn([ $this->apiKeyService->listKeys(false)->willReturn([
new ApiKey(), new ApiKey(),
new ApiKey(), new ApiKey(),
new ApiKey(), new ApiKey(),
])->shouldBeCalledOnce(); ])->shouldBeCalledOnce();
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'api-key:list', 'command' => ListKeysCommand::NAME,
]); ]);
$output = $this->commandTester->getDisplay();
$this->assertContains('Key', $output);
$this->assertContains('Is enabled', $output);
$this->assertContains(' +++ ', $output);
$this->assertNotContains(' --- ', $output);
$this->assertContains('Expiration date', $output);
} }
/** /**
* @test * @test
*/ */
public function ifEnabledOnlyIsProvidedOnlyThoseKeysAreListed() public function onlyEnabledKeysAreListedIfEnabledOnlyIsProvided()
{ {
$this->apiKeyService->listKeys(true)->willReturn([ $this->apiKeyService->listKeys(true)->willReturn([
new ApiKey(), (new ApiKey())->disable(),
new ApiKey(), new ApiKey(),
])->shouldBeCalledOnce(); ])->shouldBeCalledOnce();
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'api-key:list', 'command' => ListKeysCommand::NAME,
'--enabledOnly' => true, '--enabledOnly' => true,
]); ]);
$output = $this->commandTester->getDisplay();
$this->assertContains('Key', $output);
$this->assertNotContains('Is enabled', $output);
$this->assertNotContains(' +++ ', $output);
$this->assertNotContains(' --- ', $output);
$this->assertContains('Expiration date', $output);
} }
} }