@@ -68,31 +68,62 @@ public function testRefreshUser()
68
68
$ provider1 = $ this ->getProvider ();
69
69
$ provider1
70
70
->expects ($ this ->once ())
71
- ->method ('refreshUser ' )
72
- ->willThrowException ( new UnsupportedUserException ( ' unsupported ' ) )
71
+ ->method ('supportsClass ' )
72
+ ->willReturn ( false )
73
73
;
74
74
75
75
$ provider2 = $ this ->getProvider ();
76
+ $ provider2
77
+ ->expects ($ this ->once ())
78
+ ->method ('supportsClass ' )
79
+ ->willReturn (true )
80
+ ;
81
+
76
82
$ provider2
83
+ ->expects ($ this ->once ())
84
+ ->method ('refreshUser ' )
85
+ ->willThrowException (new UnsupportedUserException ('unsupported ' ))
86
+ ;
87
+
88
+ $ provider3 = $ this ->getProvider ();
89
+ $ provider3
90
+ ->expects ($ this ->once ())
91
+ ->method ('supportsClass ' )
92
+ ->willReturn (true )
93
+ ;
94
+
95
+ $ provider3
77
96
->expects ($ this ->once ())
78
97
->method ('refreshUser ' )
79
98
->willReturn ($ account = $ this ->getAccount ())
80
99
;
81
100
82
- $ provider = new ChainUserProvider ([$ provider1 , $ provider2 ]);
101
+ $ provider = new ChainUserProvider ([$ provider1 , $ provider2, $ provider3 ]);
83
102
$ this ->assertSame ($ account , $ provider ->refreshUser ($ this ->getAccount ()));
84
103
}
85
104
86
105
public function testRefreshUserAgain ()
87
106
{
88
107
$ provider1 = $ this ->getProvider ();
108
+ $ provider1
109
+ ->expects ($ this ->once ())
110
+ ->method ('supportsClass ' )
111
+ ->willReturn (true )
112
+ ;
113
+
89
114
$ provider1
90
115
->expects ($ this ->once ())
91
116
->method ('refreshUser ' )
92
117
->willThrowException (new UsernameNotFoundException ('not found ' ))
93
118
;
94
119
95
120
$ provider2 = $ this ->getProvider ();
121
+ $ provider2
122
+ ->expects ($ this ->once ())
123
+ ->method ('supportsClass ' )
124
+ ->willReturn (true )
125
+ ;
126
+
96
127
$ provider2
97
128
->expects ($ this ->once ())
98
129
->method ('refreshUser ' )
@@ -107,13 +138,25 @@ public function testRefreshUserThrowsUnsupportedUserException()
107
138
{
108
139
$ this ->expectException ('Symfony\Component\Security\Core\Exception\UnsupportedUserException ' );
109
140
$ provider1 = $ this ->getProvider ();
141
+ $ provider1
142
+ ->expects ($ this ->once ())
143
+ ->method ('supportsClass ' )
144
+ ->willReturn (true )
145
+ ;
146
+
110
147
$ provider1
111
148
->expects ($ this ->once ())
112
149
->method ('refreshUser ' )
113
150
->willThrowException (new UnsupportedUserException ('unsupported ' ))
114
151
;
115
152
116
153
$ provider2 = $ this ->getProvider ();
154
+ $ provider2
155
+ ->expects ($ this ->once ())
156
+ ->method ('supportsClass ' )
157
+ ->willReturn (true )
158
+ ;
159
+
117
160
$ provider2
118
161
->expects ($ this ->once ())
119
162
->method ('refreshUser ' )
@@ -171,13 +214,25 @@ public function testSupportsClassWhenNotSupported()
171
214
public function testAcceptsTraversable ()
172
215
{
173
216
$ provider1 = $ this ->getProvider ();
217
+ $ provider1
218
+ ->expects ($ this ->once ())
219
+ ->method ('supportsClass ' )
220
+ ->willReturn (true )
221
+ ;
222
+
174
223
$ provider1
175
224
->expects ($ this ->once ())
176
225
->method ('refreshUser ' )
177
226
->willThrowException (new UnsupportedUserException ('unsupported ' ))
178
227
;
179
228
180
229
$ provider2 = $ this ->getProvider ();
230
+ $ provider2
231
+ ->expects ($ this ->once ())
232
+ ->method ('supportsClass ' )
233
+ ->willReturn (true )
234
+ ;
235
+
181
236
$ provider2
182
237
->expects ($ this ->once ())
183
238
->method ('refreshUser ' )
0 commit comments