Skip to content
This repository has been archived by the owner on Sep 26, 2020. It is now read-only.

Commit

Permalink
fix infections
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikzogg committed Nov 6, 2019
1 parent 90439a3 commit ccd82ce
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@test:insights"
],
"test:cs": "mkdir -p build && vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache",
"test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=92 --verbose --coverage=build/phpunit",
"test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=100 --verbose --coverage=build/phpunit",
"test:insights": "mkdir -p build && bash -c 'vendor/bin/phpinsights analyse -v --no-interaction --min-quality=98 --disable-security-check | tee build/phpinsights.log; if [ ${PIPESTATUS[0]} -ne \"0\" ]; then exit 1; fi'",
"test:integration": "vendor/bin/phpunit --testsuite=Integration --cache-result-file=build/phpunit/phpunit.result.cache",
"test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log",
Expand Down
6 changes: 3 additions & 3 deletions src/Command/CleanDirectoriesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 0;
}

private function cleanDirectory(string $path, int $level = 1): void
private function cleanDirectory(string $path, bool $rmdir = false): void
{
$directoryIterator = new \DirectoryIterator($path);
foreach ($directoryIterator as $element) {
if ($element->isFile()) {
unlink($element->getRealPath());
} elseif (!$element->isDot() && $element->isDir()) {
$this->cleanDirectory($element->getRealPath(), $level + 1);
$this->cleanDirectory($element->getRealPath(), true);
}
}

if (1 !== $level) {
if ($rmdir) {
rmdir($path);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Pimple/ConfigServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function register(Container $container): void
$container['chubbyphp.config.directories'] = $config->getDirectories();
foreach ($container['chubbyphp.config.directories'] as $requiredDirectory) {
if (!is_dir($requiredDirectory)) {
mkdir($requiredDirectory, 0777, true);
mkdir($requiredDirectory, 0775, true);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/Pimple/ConfigServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function testRegisterWithExistingArray(): void
],
'key3' => [
'value33',
'value34',
],
'key4' => 'value4',
],
Expand Down Expand Up @@ -146,11 +147,14 @@ public function testRegisterWithExistingArray(): void
0 => 'value31',
2 => 'value32',
3 => 'value33',
4 => 'value34',
],
'key4' => 'value4',
], $container['key']);

self::assertDirectoryExists($directory);

self::assertSame('0775', substr(sprintf('%o', fileperms($directory)), -4));
}

public function testRegisterWithExistingStringConvertToInt(): void
Expand Down

0 comments on commit ccd82ce

Please sign in to comment.