Skip to content

Commit

Permalink
Prevent unnecessary IO in tests (#3814)
Browse files Browse the repository at this point in the history
* Prevent unnecessary IO in tests

* Update ContainerBuilderFactory.php
  • Loading branch information
staabm committed May 12, 2023
1 parent 5229535 commit 5541090
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/Testing/PHPUnit/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ protected function getService(string $type): object
*/
private function createConfigsHash(array $configFiles): string
{
Assert::allFile($configFiles);
Assert::allString($configFiles);

$configHash = '';
foreach ($configFiles as $configFile) {
$configHash .= md5_file($configFile);
$hash = md5_file($configFile);
if ($hash === false) {
throw new ShouldNotHappenException(sprintf('File %s is not readable', $configFile));
}
$configHash .= $hash;
}

return $configHash;
Expand Down
1 change: 0 additions & 1 deletion src/Kernel/ContainerBuilderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function create(array $configFiles, array $compilerPasses): ContainerBuil
Assert::allIsAOf($compilerPasses, CompilerPassInterface::class);

Assert::allString($configFiles);
Assert::allFile($configFiles);

$containerBuilder = new ContainerBuilder();

Expand Down

0 comments on commit 5541090

Please sign in to comment.