Skip to content

Commit

Permalink
Add app secret to const instead of reading it from container
Browse files Browse the repository at this point in the history
  • Loading branch information
momocode-de authored and rommelfreddy committed Dec 11, 2024
1 parent fb6b736 commit c78769e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/Components/RedirectHandler/RedirectHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
class RedirectHandlerTest extends TestCase
{
use KernelTestBehaviour;
private const APP_SECRET = 's$cretf0rt3st';

public function testItEncodesUrlWithoutDatabase(): void
{
Expand All @@ -33,7 +34,7 @@ public function testItEncodesUrlWithoutDatabase(): void
$redirectHandler = new RedirectHandler(
$connection,
$router,
$this->getContainer()->getParameter('env.app_secret')
self::APP_SECRET
);

$url = $redirectHandler->encode('the-url');
Expand All @@ -52,7 +53,7 @@ public function testItEncodesUrlWithDatabase(): array
$redirectHandler = new RedirectHandler(
$connection,
$router,
$this->getContainer()->getParameter('env.app_secret')
self::APP_SECRET
);

$originalUrl = 'the-url';
Expand Down Expand Up @@ -83,7 +84,7 @@ public function testItDecodesHashWithDatabase(array $data): void
$redirectHandler = new RedirectHandler(
$connection,
$router,
$this->getContainer()->getParameter('env.app_secret')
self::APP_SECRET
);

$originalUrl = $redirectHandler->decode($data['hash']);
Expand Down Expand Up @@ -120,7 +121,7 @@ public function testItThrowsExceptionOnDecodingWithMissingUrl(): void
$redirectHandler = new RedirectHandler(
$connection,
$router,
$this->getContainer()->getParameter('env.app_secret')
self::APP_SECRET
);

$this->expectException(\RuntimeException::class);
Expand All @@ -140,7 +141,7 @@ public function testItCleansUpOldUrls(): void
$redirectHandler = new RedirectHandler(
$connection,
$router,
$this->getContainer()->getParameter('env.app_secret')
self::APP_SECRET
);

$redirectHandler->encode('the-url-1');
Expand Down

0 comments on commit c78769e

Please sign in to comment.