Skip to content

Commit

Permalink
Add nested controller route grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Dec 17, 2024
1 parent 934b2a7 commit fa2ca3f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/Feature/Recorders/SlowRequestsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,30 @@
Pulse::ignore(fn () => expect(DB::table('pulse_values')->count())->toBe(0));
});

it('handles controller nested route groups', function () {
Config::set('pulse.recorders.'.SlowRequests::class.'.threshold', 0);

Route::controller(MyController::class)->group(function () {
Route::get('index', 'index')->name('test')->withoutMiddleware('auth:admin');
})->withoutMiddleware('auth');

$response = get('/index');
Pulse::stopRecording();

$response->assertContent('ok');
$entries = DB::table('pulse_entries')->get();
expect($entries)->toHaveCount(1);
expect($entries[0]->key)->toBe(json_encode(['GET', '/index', 'MyController@index']));
});

class MyController
{
public function index()
{
return 'ok';
}
}

class ExceptionThrowingRecorder
{
public function register(callable $record, Application $app): void
Expand Down

0 comments on commit fa2ca3f

Please sign in to comment.