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

[6.x] Fix signed routes with expires parameter #38111

Merged
merged 2 commits into from
Jul 23, 2021
Merged
Changes from 1 commit
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
Next Next commit
Add failing test for temporary signed URL with expires parameter
  • Loading branch information
Sébastien Nikolaou committed Jul 22, 2021
commit f625e6210134525f28e941a3d9ef697173ed1a5c
12 changes: 12 additions & 0 deletions tests/Integration/Routing/UrlSigningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ public function testTemporarySignedUrls()
$this->assertSame('invalid', $this->get($url)->original);
}

public function testTemporarySignedUrlsWithExpiresParameter()
{
Route::get('/foo/{id}', function (Request $request, $id) {
return $request->hasValidSignature() ? 'valid' : 'invalid';
})->name('foo');

Carbon::setTestNow(Carbon::create(2018, 1, 1));
$this->assertIsString($url = URL::temporarySignedRoute('foo', now()->addMinutes(5), ['id' => 1, 'expires' => 253402300799]));
Carbon::setTestNow(Carbon::create(2018, 1, 1)->addMinutes(10));
$this->assertSame('invalid', $this->get($url)->original);
}

public function testSignedUrlWithUrlWithoutSignatureParameter()
{
Route::get('/foo/{id}', function (Request $request, $id) {
Expand Down