@@ -56,11 +56,15 @@ public function testHandleWithValidValues()
5656 ->willReturn ($ token )
5757 ;
5858
59- $ listener = $ this ->getMockForAbstractClass (AbstractPreAuthenticatedListener::class, [
60- $ tokenStorage ,
61- $ authenticationManager ,
62- 'TheProviderKey ' ,
63- ]);
59+ $ listener = $ this ->getMockBuilder (AbstractPreAuthenticatedListener::class)
60+ ->setConstructorArgs ([
61+ $ tokenStorage ,
62+ $ authenticationManager ,
63+ 'TheProviderKey ' ,
64+ ])
65+ ->onlyMethods (['getPreAuthenticatedData ' ])
66+ ->getMock ();
67+
6468 $ listener
6569 ->expects ($ this ->once ())
6670 ->method ('getPreAuthenticatedData ' )
@@ -95,12 +99,15 @@ public function testHandleWhenAuthenticationFails()
9599 ->willThrowException ($ exception )
96100 ;
97101
98- $ listener = $ this ->getMockForAbstractClass (
99- AbstractPreAuthenticatedListener::class, [
100- $ tokenStorage ,
101- $ authenticationManager ,
102- 'TheProviderKey ' ,
103- ]);
102+ $ listener = $ this ->getMockBuilder (AbstractPreAuthenticatedListener::class)
103+ ->setConstructorArgs ([
104+ $ tokenStorage ,
105+ $ authenticationManager ,
106+ 'TheProviderKey ' ,
107+ ])
108+ ->onlyMethods (['getPreAuthenticatedData ' ])
109+ ->getMock ();
110+
104111 $ listener
105112 ->expects ($ this ->once ())
106113 ->method ('getPreAuthenticatedData ' )
@@ -137,12 +144,15 @@ public function testHandleWhenAuthenticationFailsWithDifferentToken()
137144 ->willThrowException ($ exception )
138145 ;
139146
140- $ listener = $ this ->getMockForAbstractClass (
141- AbstractPreAuthenticatedListener::class, [
142- $ tokenStorage ,
143- $ authenticationManager ,
144- 'TheProviderKey ' ,
145- ]);
147+ $ listener = $ this ->getMockBuilder (AbstractPreAuthenticatedListener::class)
148+ ->setConstructorArgs ([
149+ $ tokenStorage ,
150+ $ authenticationManager ,
151+ 'TheProviderKey ' ,
152+ ])
153+ ->onlyMethods (['getPreAuthenticatedData ' ])
154+ ->getMock ();
155+
146156 $ listener
147157 ->expects ($ this ->once ())
148158 ->method ('getPreAuthenticatedData ' )
@@ -174,12 +184,15 @@ public function testHandleWithASimilarAuthenticatedToken()
174184 ->method ('authenticate ' )
175185 ;
176186
177- $ listener = $ this ->getMockForAbstractClass (
178- AbstractPreAuthenticatedListener::class, [
179- $ tokenStorage ,
180- $ authenticationManager ,
181- 'TheProviderKey ' ,
182- ]);
187+ $ listener = $ this ->getMockBuilder (AbstractPreAuthenticatedListener::class)
188+ ->setConstructorArgs ([
189+ $ tokenStorage ,
190+ $ authenticationManager ,
191+ 'TheProviderKey ' ,
192+ ])
193+ ->onlyMethods (['getPreAuthenticatedData ' ])
194+ ->getMock ();
195+
183196 $ listener
184197 ->expects ($ this ->once ())
185198 ->method ('getPreAuthenticatedData ' )
@@ -217,12 +230,15 @@ public function testHandleWithAnInvalidSimilarToken()
217230 ->willThrowException ($ exception )
218231 ;
219232
220- $ listener = $ this ->getMockForAbstractClass (
221- AbstractPreAuthenticatedListener::class, [
222- $ tokenStorage ,
223- $ authenticationManager ,
224- 'TheProviderKey ' ,
225- ]);
233+ $ listener = $ this ->getMockBuilder (AbstractPreAuthenticatedListener::class)
234+ ->setConstructorArgs ([
235+ $ tokenStorage ,
236+ $ authenticationManager ,
237+ 'TheProviderKey ' ,
238+ ])
239+ ->onlyMethods (['getPreAuthenticatedData ' ])
240+ ->getMock ();
241+
226242 $ listener
227243 ->expects ($ this ->once ())
228244 ->method ('getPreAuthenticatedData ' )
0 commit comments