Skip to content
Snippets Groups Projects
Commit 0773f779 authored by Sebastien's avatar Sebastien
Browse files

Merge branch...

Merge branch 'tuleap-98-a-non-authenticated-user-should-not-be-able-to-access-the-capsule-list-page' into 'main'

Fix - Non authenticated user can't access capsule list page

See merge request !21
parents 61215596 ee5bb3dc
Branches
Tags
1 merge request!21Fix - Non authenticated user can't access capsule list page
......@@ -33,8 +33,5 @@ security:
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
- { path: ^/(?!register|login|generate-captcha|verify/email), roles: ROLE_USER }
<?php
namespace App\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class CapsuleControllerTest extends WebTestCase
{
public function testANonAuthenticatedUserShouldNotBeAbleToAccessTheCapsuleListPage(): void
{
$client = static::createClient();
$client->request('GET', '/my_capsules');
$this->assertResponseRedirects("/login", 302);
}
}
......@@ -44,7 +44,7 @@ class RegistrationControllerTest extends WebTestCase
$this->registerUser($userEmail, $client);
$this->checkEmailHasBeenSentAndGetEmail($userEmail);
$this->checkEmailHasBeenSentAndGetEmailMessage($userEmail);
}
public function testEmailValidationRegistrationShouldEnableUser(): void
......@@ -53,7 +53,7 @@ class RegistrationControllerTest extends WebTestCase
$client = static::createClient();
$this->registerUser($userEmail, $client);
$emailMessage = $this->checkEmailHasBeenSentAndGetEmail($userEmail);
$emailMessage = $this->checkEmailHasBeenSentAndGetEmailMessage($userEmail);
$client->followRedirect();
$this->clickOnEmailMessageLink($emailMessage, $client);
......@@ -105,7 +105,7 @@ class RegistrationControllerTest extends WebTestCase
* @param string $userEmail The registered user email
* @return RawMessage The email message sent to the user
*/
private function checkEmailHasBeenSentAndGetEmail(string $userEmail): RawMessage
private function checkEmailHasBeenSentAndGetEmailMessage(string $userEmail): RawMessage
{
$this->assertEmailCount(
1,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment