Skip to content

Commit 2fe0166

Browse files
committed
Refactor login path to pretty URL
Signed-off-by: Tim Goudriaan <tim@codedmonkey.com>
1 parent b7ca011 commit 2fe0166

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

config/packages/security.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ security:
2525
lazy: true
2626
provider: database_users
2727
form_login:
28-
login_path: /?routeName=dashboard_login
28+
login_path: dashboard_login
2929
check_path: dashboard_login
3030
remember_me:
3131
secret: '%kernel.secret%'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace CodedMonkey\Dirigent\Tests\FunctionalTests\Controller\Dashboard;
4+
5+
use CodedMonkey\Dirigent\Tests\Helper\WebTestCaseTrait;
6+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7+
use Symfony\Component\HttpFoundation\Response;
8+
9+
class DashboardSecurityControllerTest extends WebTestCase
10+
{
11+
use WebTestCaseTrait;
12+
13+
/**
14+
* Verify the homepage redirects to the login page when the application is not publicly accessible.
15+
*/
16+
public function testLoginRedirect(): void
17+
{
18+
$client = static::createClient();
19+
$client->request('GET', '/');
20+
21+
$this->assertResponseStatusCodeSame(Response::HTTP_FOUND);
22+
23+
$client->followRedirect();
24+
25+
self::assertSame('/login', $client->getRequest()->getRequestUri());
26+
}
27+
}

0 commit comments

Comments
 (0)