diff --git a/src/Commands/FilamentTestsCommand.php b/src/Commands/FilamentTestsCommand.php index c6aae446..7cad3e22 100644 --- a/src/Commands/FilamentTestsCommand.php +++ b/src/Commands/FilamentTestsCommand.php @@ -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; } @@ -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) { @@ -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');