@@ -77,6 +77,13 @@ public function testSuccessAuthenticationOnValidToken()
7777 $ owner = $ this ->getMock ('ZfrOAuth2\Server\Entity\TokenOwnerInterface ' );
7878 $ token ->setOwner ($ owner );
7979
80+ $ this
81+ ->resourceServer
82+ ->expects ($ this ->atLeastOnce ())
83+ ->method ('isRequestValid ' )
84+ ->with ($ request )
85+ ->will ($ this ->returnValue (true ));
86+
8087 $ this
8188 ->resourceServer
8289 ->expects ($ this ->atLeastOnce ())
@@ -102,9 +109,11 @@ public function testFailAuthenticationOnNoToken()
102109 $ this
103110 ->resourceServer
104111 ->expects ($ this ->atLeastOnce ())
105- ->method ('getAccessToken ' )
112+ ->method ('isRequestValid ' )
106113 ->with ($ request )
107- ->will ($ this ->returnValue (null ));
114+ ->will ($ this ->returnValue (false ));
115+
116+ $ this ->resourceServer ->expects ($ this ->never ())->method ('getAccessToken ' );
108117
109118 $ this ->assertFalse ($ this ->authenticationService ->hasIdentity ());
110119 $ this ->assertNull ($ this ->authenticationService ->getIdentity ());
@@ -120,6 +129,13 @@ public function testFailAuthenticationOnExpiredToken()
120129 $ owner = $ this ->getMock ('ZfrOAuth2\Server\Entity\TokenOwnerInterface ' );
121130 $ token ->setOwner ($ owner );
122131
132+ $ this
133+ ->resourceServer
134+ ->expects ($ this ->atLeastOnce ())
135+ ->method ('isRequestValid ' )
136+ ->with ($ request )
137+ ->will ($ this ->returnValue (true ));
138+
123139 $ this
124140 ->resourceServer
125141 ->expects ($ this ->atLeastOnce ())
@@ -134,6 +150,7 @@ public function testFailAuthenticationOnExpiredToken()
134150
135151 public function testFailAuthenticationOnNoRequest ()
136152 {
153+ $ this ->resourceServer ->expects ($ this ->never ())->method ('isRequestValid ' );
137154 $ this ->resourceServer ->expects ($ this ->never ())->method ('getAccessToken ' );
138155
139156 $ this ->assertFalse ($ this ->authenticationService ->hasIdentity ());
@@ -146,6 +163,7 @@ public function testFailAuthenticationOnNonHttpRequest()
146163
147164 $ this ->mvcEvent ->expects ($ this ->any ())->method ('getRequest ' )->will ($ this ->returnValue ($ request ));
148165
166+ $ this ->resourceServer ->expects ($ this ->never ())->method ('isRequestValid ' );
149167 $ this ->resourceServer ->expects ($ this ->never ())->method ('getAccessToken ' );
150168
151169 $ this ->assertFalse ($ this ->authenticationService ->hasIdentity ());
0 commit comments