Skip to content

Commit

Permalink
Adds temporary logging to debug an issue in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
craigpaul committed Nov 26, 2023
1 parent c5329cb commit 1d1d308
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Http/Controllers/WorkflowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public function index(): JsonResponse
{
$directory = $this->app->basePath('tests/Blitz');

error_log("\n----------\n" . $directory . "\n----------");

$files = array_map(
fn (string $file) => new SplFileInfo($directory . '/' . $file),
array_values(
Expand All @@ -46,8 +48,12 @@ public function index(): JsonResponse
),
);

error_log("\n----------\n" . json_encode(array_map(fn (SplFileInfo $file) => [$file->getPathname()], $files), true) . "\n----------");

$workflows = array_map(fn (SplFileInfo $file) => Workflow::fromFile($file)->className(), $files);

error_log("\n----------\n" . json_encode($workflows, true) . "\n----------");

return $this->response->json($workflows);
}
}
21 changes: 21 additions & 0 deletions src/Support/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ public function __construct(
*/
public static function fromFile(SplFileInfo $file): static
{
error_log("\n----------\n" . ucfirst(
strtolower(
implode(' ', preg_split('/(?=\p{Lu})/u', strstr($file->getFilename(), 'Test.php', true), -1, PREG_SPLIT_NO_EMPTY)),
),
) . "\n----------");

error_log("\n----------\n" . $file->getPathname() . "\n----------");

return new static(
name: ucfirst(
strtolower(
Expand All @@ -55,6 +63,19 @@ public static function fromFile(SplFileInfo $file): static
*/
public function className(): string
{
error_log("\n----------\n" . base_path('/') . "\n----------");
error_log("\n----------\n" . $this->path . "\n----------");

error_log("\n----------\n" . str_replace(
['/', '.php'],
['\\', ''],
ucfirst(
array_reverse(
explode(base_path('/'), $this->path, 2)
)[0],
),
) . "\n----------");

return str_replace(
['/', '.php'],
['\\', ''],
Expand Down

0 comments on commit 1d1d308

Please sign in to comment.