Skip to content

Commit

Permalink
Merge pull request #155 from dissto/remove-unused-getstubvariables
Browse files Browse the repository at this point in the history
Remove unsused `getStubVariables` method and fix duration calc
  • Loading branch information
CodeWithDennis authored Apr 13, 2024
2 parents c284f68 + a890352 commit acef76e
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions src/Commands/FilamentTestsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,9 @@ protected function getSourceFile(Resource $resource): array|bool|string
$numTests = 0;
$todos = collect();
$countTodos = 0;
$start = 0;
$end = 0;
$start = microtime(true);

foreach ($this->getStubs($resource) as $stub) {

if (is_null($stub)) {
continue;
}
Expand All @@ -187,17 +185,17 @@ protected function getSourceFile(Resource $resource): array|bool|string
$countTodos++;
}

$start = microtime(true);

$contents .= $this->getStubContents($stub['path'], $stub['variables']);

$end = microtime(true);
}

$end = microtime(true);

$duration = round($end - $start, 3) * 1000;

$this->selectedResources->push([
'name' => $resourceName,
'tests' => $numTests,
'duration' => round($end - $start, 3) * 1000,
'duration' => $duration,
]);

if ($countTodos > 0) {
Expand All @@ -221,23 +219,6 @@ protected function getStubContents(string $stub, array $stubVariables = []): arr
return $contents.PHP_EOL;
}

protected function getStubVariables(Resource $resource): array
{
$variables = [];

foreach ($this->getStubs($resource) as $stub) {
if (is_null($stub)) {
continue;
}

foreach ($stub['variables'] as $key => $value) {
$variables[$key] = $value;
}
}

return $variables;
}

protected function getNormalizedResourceName(string $name): string
{
return str($name)->ucfirst()->finish('Resource');
Expand Down

0 comments on commit acef76e

Please sign in to comment.