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