88namespace Lunaweb \EmailVerification \Tests \Feature ;
99
1010
11-
1211use Illuminate \Support \Facades \Event ;
1312use Illuminate \Support \Facades \Notification ;
1413use Lunaweb \EmailVerification \Events \UserVerified ;
@@ -18,8 +17,6 @@ class RegistrationTest extends TestCase
1817{
1918
2019
21-
22-
2320 public function setUp ()
2421 {
2522 parent ::setUp ();
@@ -28,11 +25,11 @@ public function setUp()
2825 Notification::fake ();
2926
3027
31-
3228 }
3329
3430
35- public function testRegistration () {
31+ public function testRegistration ()
32+ {
3633
3734
3835 $ response = $ this ->json ('POST ' , '/register ' , [
@@ -68,13 +65,13 @@ public function testRegistration() {
6865 }
6966
7067
71-
72- public function testEmitsUserVerifedEventOnce () {
68+ public function testEmitsUserVerifedEventOnce ()
69+ {
7370
7471
7572 Event::fake ();
7673
77- $ user =
User::
create ([
'email ' =>
'[email protected] ' ,
'verified ' =>
false ]);
74+ $ user = User::
create ([
'email ' =>
'[email protected] ' ,
'verified ' =>
false ]);
7875
7976 app (\Lunaweb \EmailVerification \EmailVerification::class)->sendVerifyLink ($ user );
8077
@@ -92,20 +89,16 @@ public function testEmitsUserVerifedEventOnce() {
9289 $ this ->assertTrue ((boolean )$ user ->fresh ()->verified );
9390
9491
95-
9692 // Open activation URL second time
9793
9894 $ this ->get ($ activationUrl );
9995
100- Event::assertDispatchedTimes (UserVerified::class, 1 );
96+ $ this -> assertCount ( 1 , Event::dispatched (UserVerified::class) );
10197
10298 $ this ->assertTrue ((boolean )$ user ->fresh ()->verified );
10399
104100
105-
106-
107101 }
108102
109103
110-
111104}
0 commit comments