8
8
use Laravel \Passport \Client as ClientModel ;
9
9
use Laravel \Passport \ClientRepository ;
10
10
use Laravel \Passport \Passport ;
11
- use Mockery ;
11
+ use Mockery \Adapter \Phpunit \MockeryPHPUnitIntegration ;
12
+ use Mockery as m ;
12
13
use PHPUnit \Framework \TestCase ;
13
14
14
15
class BridgeScopeRepositoryTest extends TestCase
15
16
{
17
+ use MockeryPHPUnitIntegration;
18
+
16
19
protected function tearDown (): void
17
20
{
18
21
Passport::$ withInheritedScopes = false ;
@@ -24,9 +27,9 @@ public function test_invalid_scopes_are_removed()
24
27
'scope-1 ' => 'description ' ,
25
28
]);
26
29
27
- $ client = Mockery ::mock (ClientModel::class)->makePartial ();
30
+ $ client = m ::mock (ClientModel::class)->makePartial ();
28
31
29
- $ clients = Mockery ::mock (ClientRepository::class);
32
+ $ clients = m ::mock (ClientRepository::class);
30
33
$ clients ->shouldReceive ('findActive ' )->withAnyArgs ()->andReturn ($ client );
31
34
32
35
$ repository = new ScopeRepository ($ clients );
@@ -44,10 +47,10 @@ public function test_invalid_scopes_are_removed_without_a_client_repository()
44
47
'scope-1 ' => 'description ' ,
45
48
]);
46
49
47
- $ clients = Mockery ::mock (ClientRepository::class);
50
+ $ clients = m ::mock (ClientRepository::class);
48
51
$ clients ->shouldReceive ('findActive ' )
49
52
->with ('id ' )
50
- ->andReturn (Mockery ::mock (ClientModel::class)->makePartial ());
53
+ ->andReturn (m ::mock (ClientModel::class)->makePartial ());
51
54
52
55
$ repository = new ScopeRepository ($ clients );
53
56
@@ -65,10 +68,10 @@ public function test_clients_do_not_restrict_scopes_by_default()
65
68
'scope-2 ' => 'description ' ,
66
69
]);
67
70
68
- $ client = Mockery ::mock (ClientModel::class)->makePartial ();
71
+ $ client = m ::mock (ClientModel::class)->makePartial ();
69
72
$ client ->scopes = null ;
70
73
71
- $ clients = Mockery ::mock (ClientRepository::class);
74
+ $ clients = m ::mock (ClientRepository::class);
72
75
$ clients ->shouldReceive ('findActive ' )->withAnyArgs ()->andReturn ($ client );
73
76
74
77
$ repository = new ScopeRepository ($ clients );
@@ -87,10 +90,10 @@ public function test_scopes_disallowed_for_client_are_removed()
87
90
'scope-2 ' => 'description ' ,
88
91
]);
89
92
90
- $ client = Mockery ::mock (ClientModel::class)->makePartial ();
93
+ $ client = m ::mock (ClientModel::class)->makePartial ();
91
94
$ client ->scopes = ['scope-1 ' ];
92
95
93
- $ clients = Mockery ::mock (ClientRepository::class);
96
+ $ clients = m ::mock (ClientRepository::class);
94
97
$ clients ->shouldReceive ('findActive ' )->withAnyArgs ()->andReturn ($ client );
95
98
96
99
$ repository = new ScopeRepository ($ clients );
@@ -112,10 +115,10 @@ public function test_scopes_disallowed_for_client_are_removed_but_inherited_scop
112
115
'scope-2 ' => 'description ' ,
113
116
]);
114
117
115
- $ client = Mockery ::mock (ClientModel::class)->makePartial ();
118
+ $ client = m ::mock (ClientModel::class)->makePartial ();
116
119
$ client ->scopes = ['scope-1 ' ];
117
120
118
- $ clients = Mockery ::mock (ClientRepository::class);
121
+ $ clients = m ::mock (ClientRepository::class);
119
122
$ clients ->shouldReceive ('findActive ' )->withAnyArgs ()->andReturn ($ client );
120
123
121
124
$ repository = new ScopeRepository ($ clients );
@@ -133,9 +136,9 @@ public function test_superuser_scope_cant_be_applied_if_wrong_grant()
133
136
'scope-1 ' => 'description ' ,
134
137
]);
135
138
136
- $ client = Mockery ::mock (ClientModel::class)->makePartial ();
139
+ $ client = m ::mock (ClientModel::class)->makePartial ();
137
140
138
- $ clients = Mockery ::mock (ClientRepository::class);
141
+ $ clients = m ::mock (ClientRepository::class);
139
142
$ clients ->shouldReceive ('findActive ' )->withAnyArgs ()->andReturn ($ client );
140
143
141
144
$ repository = new ScopeRepository ($ clients );
@@ -153,10 +156,10 @@ public function test_superuser_scope_cant_be_applied_if_wrong_grant_without_a_cl
153
156
'scope-1 ' => 'description ' ,
154
157
]);
155
158
156
- $ clients = Mockery ::mock (ClientRepository::class);
159
+ $ clients = m ::mock (ClientRepository::class);
157
160
$ clients ->shouldReceive ('findActive ' )
158
161
->with ('id ' )
159
- ->andReturn (Mockery ::mock (ClientModel::class)->makePartial ());
162
+ ->andReturn (m ::mock (ClientModel::class)->makePartial ());
160
163
161
164
$ repository = new ScopeRepository ($ clients );
162
165
0 commit comments