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 1
1
<?php
2
2
3
+ use App \Models \User ;
4
+
3
5
test ('it can show the register page ' , function () {
4
6
visit ('/register ' )
5
7
->assertNoConsoleLogs ()
19
21
20
22
$ this ->assertAuthenticated ();
21
23
});
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 9
9
->assertSee ('Register ' );
10
10
});
11
11
12
-
13
12
test ('it can browse to the register page ' , function () {
14
13
visit ('/ ' )
15
- ->assertNoConsoleLogs ()
16
- ->assertNoJavaScriptErrors ()
17
14
->click ('Register ' )
18
15
->assertPathEndsWith ('/register ' )
19
16
->assertNoConsoleLogs ()
20
17
->assertNoJavaScriptErrors ()
21
18
->assertSee ('Create an account ' )
22
19
->assertSee ('Enter your details below to create your account ' );
23
20
});
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