File tree Expand file tree Collapse file tree 2 files changed +41
-3
lines changed
Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 11<?php
22
3+ use App \Models \User ;
4+
35test ('it can show the register page ' , function () {
46 visit ('/register ' )
57 ->assertNoConsoleLogs ()
1921
2022 $ this ->assertAuthenticated ();
2123});
24+
25+ test ('it cannot register a new user when email has already been taken ' , function () {
26+ User::factory ()->create ([
27+ 'name ' => 'Taylor ' ,
28+ 29+ ]);
30+
31+ visit ('/register ' )
32+ ->fill ('name ' , 'Taylor Otwell ' )
33+ ->
fill (
'email ' ,
'[email protected] ' )
34+ ->fill ('password ' , 'password ' )
35+ ->fill ('password_confirmation ' , 'password ' )
36+ ->press ('Create account ' )
37+ ->assertSee ('The email has already been taken. ' );
38+
39+ $ this ->assertGuest ();
40+ });
41+
42+ test ('it cannot register a new user when password does not match ' , function () {
43+ visit ('/register ' )
44+ ->fill ('name ' , 'Taylor Otwell ' )
45+ ->
fill (
'email ' ,
'[email protected] ' )
46+ ->fill ('password ' , 'password ' )
47+ ->fill ('password_confirmation ' , 'secret ' )
48+ ->press ('Create account ' )
49+ ->assertSee ('The password field confirmation does not match. ' );
50+
51+ $ this ->assertGuest ();
52+ });
Original file line number Diff line number Diff line change 99 ->assertSee ('Register ' );
1010});
1111
12-
1312test ('it can browse to the register page ' , function () {
1413 visit ('/ ' )
15- ->assertNoConsoleLogs ()
16- ->assertNoJavaScriptErrors ()
1714 ->click ('Register ' )
1815 ->assertPathEndsWith ('/register ' )
1916 ->assertNoConsoleLogs ()
2017 ->assertNoJavaScriptErrors ()
2118 ->assertSee ('Create an account ' )
2219 ->assertSee ('Enter your details below to create your account ' );
2320});
21+
22+ test ('it can browse to the login page ' , function () {
23+ visit ('/ ' )
24+ ->click ('Log in ' )
25+ ->assertPathEndsWith ('/login ' )
26+ ->assertNoConsoleLogs ()
27+ ->assertNoJavaScriptErrors ()
28+ ->assertSee ('Log in to your account ' )
29+ ->assertSee ('Enter your email and password below to log in ' );
30+ });
You can’t perform that action at this time.
0 commit comments