File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 4
4
use Illuminate \Foundation \Testing \WithFaker ;
5
5
use Chatbox \Larabase \FirebaseAuth ;
6
6
use Kreait \Firebase \Auth \UserRecord ;
7
+ use Closure ;
7
8
8
9
/**
9
10
* Created by PhpStorm.
@@ -16,10 +17,24 @@ class TestFirebaseUser extends FirebaseUser
16
17
{
17
18
use WithFaker;
18
19
20
+ static protected $ users = [];
21
+
19
22
static public function fake ():TestFirebaseUser {
20
23
return (new static ())->makeFackObject ();
21
24
}
22
25
26
+ static public function users (){
27
+ return static ::$ users ;
28
+ }
29
+
30
+ static public function remenber (Closure $ caller ){
31
+ foreach (static ::$ users as $ token => $ user ) {
32
+ assert ($ user instanceof TestFirebaseUser);
33
+ $ user ->recordAs ($ token );
34
+ $ caller ($ token ,$ user );
35
+ }
36
+ }
37
+
23
38
/**
24
39
* UserRecord constructor.
25
40
*/
@@ -42,6 +57,7 @@ public function recordAs($token){
42
57
$ auth ->setUser ($ token ,$ this );
43
58
return $ auth ;
44
59
});
60
+ static ::$ users [$ token ] = $ this ;
45
61
return $ this ;
46
62
}
47
63
}
You can’t perform that action at this time.
0 commit comments