Skip to content

Commit e1724d2

Browse files
committed
Add test
1 parent 22ab49e commit e1724d2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/RedirectTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ public function an_url_could_expire()
4242
$this->assertEquals(410, $response->status());
4343
}
4444

45+
/** @test */
46+
public function an_url_with_expiration_date_in_future_is_redirected()
47+
{
48+
$url = ['url' => 'https://laravel.com', 'code' => 'abcde', 'expires_at' => Carbon::now()->add('PT10M')];
49+
50+
$this->createUrl($url);
51+
52+
$response = $this->get(route('shorturl.redirect', ['code' => $url['code']]));
53+
54+
$this->assertEquals($url['url'], $response->headers->get('Location'));
55+
$this->assertEquals(302, $response->status());
56+
}
57+
4558
/** @test */
4659
public function it_redirects_to_the_correct_url_after_update()
4760
{

0 commit comments

Comments
 (0)