Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Add nested controller route grouping #433

Merged
merged 2 commits into from
Dec 17, 2024
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
2 changes: 1 addition & 1 deletion src/Support/RedisAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function xadd(string $key, array $dictionary): string|Pipeline|PhpRedis|R
*/
public function xrange(string $key, string $start, string $end, ?int $count = null): array
{
return collect($this->handle([ // @phpstan-ignore return.type, argument.templateType, argument.templateType
return collect($this->handle([ // @phpstan-ignore argument.templateType, argument.templateType
'XRANGE',
$this->config->get('database.redis.options.prefix').$key,
$start,
Expand Down
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
Loading