@@ -15,11 +15,13 @@ class AuthEventsTest extends TestCase
15
15
16
16
public function testAuthenticatedEventFillsUserOnScope (): void
17
17
{
18
- $ user = new AuthEventsTestUserModel () ;
18
+ $ user = new AuthEventsTestUserModel ;
19
19
20
- $ user ->id = 123 ;
21
- $ user ->username = 'username ' ;
22
- $ user->
email =
'[email protected] ' ;
20
+ $ user ->forceFill ([
21
+ 'id ' => 123 ,
22
+ 'username ' => 'username ' ,
23
+
24
+ ]);
23
25
24
26
$ scope = $ this ->getCurrentSentryScope ();
25
27
@@ -29,17 +31,19 @@ public function testAuthenticatedEventFillsUserOnScope(): void
29
31
30
32
$ this ->assertNotNull ($ scope ->getUser ());
31
33
32
- $ this ->assertEquals ($ scope ->getUser ()->getId (), 123 );
33
- $ this ->assertEquals ($ scope ->getUser ()->getUsername (), ' username ' );
34
- $ this ->
assertEquals (
$ scope->
getUser ()->
getEmail ()
, ' [email protected] ' );
34
+ $ this ->assertEquals (123 , $ scope ->getUser ()->getId ());
35
+ $ this ->assertEquals (' username ' , $ scope ->getUser ()->getUsername ());
36
+ $ this ->
assertEquals (
' [email protected] ' , $ scope->
getUser ()->
getEmail ());
35
37
}
36
38
37
39
public function testAuthenticatedEventFillsUserOnScopeWhenUsernameIsNotAString (): void
38
40
{
39
41
$ user = new AuthEventsTestUserModel ();
40
42
41
- $ user ->id = 123 ;
42
- $ user ->username = 456 ;
43
+ $ user ->forceFill ([
44
+ 'id ' => 123 ,
45
+ 'username ' => 456 ,
46
+ ]);
43
47
44
48
$ scope = $ this ->getCurrentSentryScope ();
45
49
@@ -49,8 +53,8 @@ public function testAuthenticatedEventFillsUserOnScopeWhenUsernameIsNotAString()
49
53
50
54
$ this ->assertNotNull ($ scope ->getUser ());
51
55
52
- $ this ->assertEquals ($ scope ->getUser ()->getId (), 123 );
53
- $ this ->assertEquals ($ scope ->getUser ()->getUsername (), ' 456 ' );
56
+ $ this ->assertEquals (123 , $ scope ->getUser ()->getId ());
57
+ $ this ->assertEquals (' 456 ' , $ scope ->getUser ()->getUsername ());
54
58
}
55
59
56
60
public function testAuthenticatedEventDoesNotFillUserOnScopeWhenPIIShouldNotBeSent (): void
0 commit comments