Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Console/RoutesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private function outputText(string $specName, array $specOps, array $undocumente
$rows[] = [
$op['matched'] ? '<fg=green>matched</>' : '<fg=red>unimplemented</>',
$op['method'],
$op['path'],
$op['resolved'],
];
}

Expand Down Expand Up @@ -262,7 +262,7 @@ private function outputJson(string $specName, array $specOps, array $undocumente
'filters' => (object) $filters,
'spec_operations' => array_map(fn ($op) => [
'method' => $op['method'],
'path' => $op['path'],
'path' => $op['resolved'],
'status' => $op['matched'] ? 'matched' : 'unimplemented',
], $specOps),
'undocumented_routes' => array_values(array_map(function (string $key) {
Expand Down
18 changes: 18 additions & 0 deletions tests/Console/RoutesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,24 @@ public function test_prefix_filter_does_not_match_partial_path_segment(): void
->doesntExpectOutputToContain('/api/v20/other');
}

#[Test]
public function test_displayed_path_includes_configured_path_prefix(): void
{
config(['spectator.path_prefix' => 'api/v4']);

Route::get('/api/v4/users', fn () => [])->name('users.index');

$this->artisan('spectator:routes', [
'--spec' => 'Test.v1.yml',
'--prefix' => 'api/v4',
'--format' => 'json',
])
->assertExitCode(0)
->expectsOutputToContain('"status": "matched"')
->expectsOutputToContain('"path": "/api/v4/users"')
->doesntExpectOutputToContain('"path": "/users"');
}

#[Test]
public function test_middleware_filter_matches_parameterized_middleware(): void
{
Expand Down
Loading