@@ -68,31 +68,62 @@ public function testRefreshUser()
6868 $ provider1 = $ this ->getProvider ();
6969 $ provider1
7070 ->expects ($ this ->once ())
71- ->method ('refreshUser ' )
72- ->willThrowException ( new UnsupportedUserException ( ' unsupported ' ) )
71+ ->method ('supportsClass ' )
72+ ->willReturn ( false )
7373 ;
7474
7575 $ provider2 = $ this ->getProvider ();
76+ $ provider2
77+ ->expects ($ this ->once ())
78+ ->method ('supportsClass ' )
79+ ->willReturn (true )
80+ ;
81+
7682 $ 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
7796 ->expects ($ this ->once ())
7897 ->method ('refreshUser ' )
7998 ->willReturn ($ account = $ this ->getAccount ())
8099 ;
81100
82- $ provider = new ChainUserProvider ([$ provider1 , $ provider2 ]);
101+ $ provider = new ChainUserProvider ([$ provider1 , $ provider2, $ provider3 ]);
83102 $ this ->assertSame ($ account , $ provider ->refreshUser ($ this ->getAccount ()));
84103 }
85104
86105 public function testRefreshUserAgain ()
87106 {
88107 $ provider1 = $ this ->getProvider ();
108+ $ provider1
109+ ->expects ($ this ->once ())
110+ ->method ('supportsClass ' )
111+ ->willReturn (true )
112+ ;
113+
89114 $ provider1
90115 ->expects ($ this ->once ())
91116 ->method ('refreshUser ' )
92117 ->willThrowException (new UsernameNotFoundException ('not found ' ))
93118 ;
94119
95120 $ provider2 = $ this ->getProvider ();
121+ $ provider2
122+ ->expects ($ this ->once ())
123+ ->method ('supportsClass ' )
124+ ->willReturn (true )
125+ ;
126+
96127 $ provider2
97128 ->expects ($ this ->once ())
98129 ->method ('refreshUser ' )
@@ -107,13 +138,25 @@ public function testRefreshUserThrowsUnsupportedUserException()
107138 {
108139 $ this ->expectException ('Symfony\Component\Security\Core\Exception\UnsupportedUserException ' );
109140 $ provider1 = $ this ->getProvider ();
141+ $ provider1
142+ ->expects ($ this ->once ())
143+ ->method ('supportsClass ' )
144+ ->willReturn (true )
145+ ;
146+
110147 $ provider1
111148 ->expects ($ this ->once ())
112149 ->method ('refreshUser ' )
113150 ->willThrowException (new UnsupportedUserException ('unsupported ' ))
114151 ;
115152
116153 $ provider2 = $ this ->getProvider ();
154+ $ provider2
155+ ->expects ($ this ->once ())
156+ ->method ('supportsClass ' )
157+ ->willReturn (true )
158+ ;
159+
117160 $ provider2
118161 ->expects ($ this ->once ())
119162 ->method ('refreshUser ' )
@@ -171,13 +214,25 @@ public function testSupportsClassWhenNotSupported()
171214 public function testAcceptsTraversable ()
172215 {
173216 $ provider1 = $ this ->getProvider ();
217+ $ provider1
218+ ->expects ($ this ->once ())
219+ ->method ('supportsClass ' )
220+ ->willReturn (true )
221+ ;
222+
174223 $ provider1
175224 ->expects ($ this ->once ())
176225 ->method ('refreshUser ' )
177226 ->willThrowException (new UnsupportedUserException ('unsupported ' ))
178227 ;
179228
180229 $ provider2 = $ this ->getProvider ();
230+ $ provider2
231+ ->expects ($ this ->once ())
232+ ->method ('supportsClass ' )
233+ ->willReturn (true )
234+ ;
235+
181236 $ provider2
182237 ->expects ($ this ->once ())
183238 ->method ('refreshUser ' )
0 commit comments