File tree Expand file tree Collapse file tree 5 files changed +29
-12
lines changed
tests/Feature/Controllers Expand file tree Collapse file tree 5 files changed +29
-12
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,9 @@ public function store(ResetPasswordStore $request)
22
22
{
23
23
$ status = Password::sendResetLink ($ request ->only ('email ' ));
24
24
25
- if ($ status !== Password::RESET_LINK_SENT ) {
26
- throw ValidationException::withMessages ([
27
- 'reset_link ' => \__ ($ status ),
28
- ]);
29
- }
25
+ \throw_if ($ status !== Password::RESET_LINK_SENT , ValidationException::withMessages ([
26
+ 'reset_link ' => \__ ($ status ),
27
+ ]));
30
28
31
29
\session ()->flash ('success ' , \__ ('passwords.sent ' ));
32
30
@@ -53,11 +51,9 @@ public function update(ResetPasswordUpdate $request)
53
51
\event (new PasswordReset ($ user ));
54
52
});
55
53
56
- if ($ status !== Password::PASSWORD_RESET ) {
57
- throw ValidationException::withMessages ([
58
- 'reset ' => __ ($ status ),
59
- ]);
60
- }
54
+ \throw_if ($ status !== Password::PASSWORD_RESET , ValidationException::withMessages ([
55
+ 'reset ' => \__ ($ status ),
56
+ ]));
61
57
62
58
\session ()->flash ('success ' , \__ ('passwords.reset ' ));
63
59
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ public function boot(): void
14
14
{
15
15
JsonResource::withoutWrapping ();
16
16
17
+ // @codeCoverageIgnoreStart
17
18
Carbon::macro ('inAppTimezone ' , function () {
18
19
return $ this ->tz (config ('app.timezone_display ' ));
19
20
});
@@ -22,7 +23,6 @@ public function boot(): void
22
23
return $ this ->tz (auth ()->user ()?->timezone ?? config ('app.timezone_display ' ));
23
24
});
24
25
25
- // @codeCoverageIgnoreStart
26
26
Pulse::users (function ($ ids ) {
27
27
return User::findMany ($ ids )->map (fn ($ user ) => [
28
28
'id ' => $ user ->id ,
Original file line number Diff line number Diff line change @@ -11,8 +11,10 @@ class AuthServiceProvider extends ServiceProvider
11
11
{
12
12
public function boot (): void
13
13
{
14
+ // @codeCoverageIgnoreStart
14
15
Gate::define ('viewPulse ' , function (User $ user ) {
15
16
return $ user ->hasRole (Role::SUPER_ADMIN ->value );
16
17
});
18
+ // @codeCoverageIgnoreEnd
17
19
}
18
20
}
Original file line number Diff line number Diff line change 6
6
7
7
use function Pest \Laravel \actingAs ;
8
8
use function Pest \Laravel \get ;
9
+ use function Pest \Laravel \withoutExceptionHandling ;
9
10
10
11
describe ('Users ' , function () {
11
12
test ('Can access the verification page ' , function () {
17
18
);
18
19
});
19
20
21
+ test ('Can verify their email address ' , function () {
22
+ withoutExceptionHandling ();
23
+
24
+ $ user = User::factory ()->unverified ()->create ();
25
+
26
+ expect ($ user ->verified_at )->toBeNull ();
27
+
28
+ actingAs ($ user )
29
+ ->withoutMiddleware (Illuminate \Routing \Middleware \ValidateSignature::class)
30
+ ->get (route ('verification.verify ' , [
31
+ 'id ' => $ user ->getKey (),
32
+ 'hash ' => sha1 ($ user ->getEmailForVerification ()),
33
+ ]))
34
+ ->assertRedirect (route ('home ' ));
35
+
36
+ expect ($ user ->refresh ()->email_verified_at )->not ()->toBeNull ();
37
+ });
38
+
20
39
test ('Can send the verificaiton notice ' , function () {
21
40
Notification::fake ();
22
41
Original file line number Diff line number Diff line change 20
20
);
21
21
});
22
22
23
- test ('A password reset email can be sent ' , function () {
23
+ test ('A password reset email can be requested ' , function () {
24
24
Notification::fake ();
25
25
26
26
$ user = User::factory ()->create ();
You can’t perform that action at this time.
0 commit comments