Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Memorekall Member New
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rekall
Memorekall Member New
Commits
d00474ba
Commit
d00474ba
authored
Dec 8, 2021
by
Camille Simiand
Browse files
Options
Downloads
Patches
Plain Diff
Add functional tests
parent
7d279ea4
No related branches found
No related tags found
1 merge request
!19
Add a redirection to capsule_list in registration controller
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/functional/LoginTest.php
+1
-0
1 addition, 0 deletions
tests/functional/LoginTest.php
tests/functional/RegistrationControllerTest.php
+24
-0
24 additions, 0 deletions
tests/functional/RegistrationControllerTest.php
with
25 additions
and
0 deletions
tests/functional/LoginTest.php
+
1
−
0
View file @
d00474ba
...
...
@@ -2,6 +2,7 @@
namespace
App\Tests\Controller
;
use
App\Repository\UserRepository
;
use
Symfony\Bundle\FrameworkBundle\KernelBrowser
;
use
Symfony\Bundle\FrameworkBundle\Test\WebTestCase
;
use
Symfony\Component\DomCrawler\Form
;
...
...
This diff is collapsed.
Click to expand it.
tests/functional/RegistrationControllerTest.php
+
24
−
0
View file @
d00474ba
...
...
@@ -77,6 +77,30 @@ class RegistrationControllerTest extends WebTestCase
$this
->
assertResponseIsSuccessful
(
'Once the user has validated his email, he should be on the login page'
);
}
public
function
testAnAuthenticatedUserShouldNotBeAbleToAccessTheRegisterPage
():
void
{
$client
=
static
::
createClient
();
$userRepository
=
static
::
getContainer
()
->
get
(
UserRepository
::
class
);
$testUser
=
$userRepository
->
findOneByEmail
(
'defaultUser@localhost.com'
);
$client
->
loginUser
(
$testUser
);
$client
->
request
(
'GET'
,
'/register'
);
$this
->
assertResponseRedirects
(
'/my_capsules'
,
302
);
}
public
function
testAnAuthenticatedUserShouldNotBeAbleToAccessTheLoginPage
():
void
{
$client
=
static
::
createClient
();
$userRepository
=
static
::
getContainer
()
->
get
(
UserRepository
::
class
);
$testUser
=
$userRepository
->
findOneByEmail
(
'defaultUser@localhost.com'
);
$client
->
loginUser
(
$testUser
);
$client
->
request
(
'GET'
,
'/login'
);
$this
->
assertResponseRedirects
(
'/my_capsules'
,
302
);
}
/**
* @param string $userEmail The registered user email
* @return RawMessage The email message sent to the user
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment