@@ -77,6 +77,13 @@ public function testSuccessAuthenticationOnValidToken()
77
77
$ owner = $ this ->getMock ('ZfrOAuth2\Server\Entity\TokenOwnerInterface ' );
78
78
$ token ->setOwner ($ owner );
79
79
80
+ $ this
81
+ ->resourceServer
82
+ ->expects ($ this ->atLeastOnce ())
83
+ ->method ('isRequestValid ' )
84
+ ->with ($ request )
85
+ ->will ($ this ->returnValue (true ));
86
+
80
87
$ this
81
88
->resourceServer
82
89
->expects ($ this ->atLeastOnce ())
@@ -102,9 +109,11 @@ public function testFailAuthenticationOnNoToken()
102
109
$ this
103
110
->resourceServer
104
111
->expects ($ this ->atLeastOnce ())
105
- ->method ('getAccessToken ' )
112
+ ->method ('isRequestValid ' )
106
113
->with ($ request )
107
- ->will ($ this ->returnValue (null ));
114
+ ->will ($ this ->returnValue (false ));
115
+
116
+ $ this ->resourceServer ->expects ($ this ->never ())->method ('getAccessToken ' );
108
117
109
118
$ this ->assertFalse ($ this ->authenticationService ->hasIdentity ());
110
119
$ this ->assertNull ($ this ->authenticationService ->getIdentity ());
@@ -120,6 +129,13 @@ public function testFailAuthenticationOnExpiredToken()
120
129
$ owner = $ this ->getMock ('ZfrOAuth2\Server\Entity\TokenOwnerInterface ' );
121
130
$ token ->setOwner ($ owner );
122
131
132
+ $ this
133
+ ->resourceServer
134
+ ->expects ($ this ->atLeastOnce ())
135
+ ->method ('isRequestValid ' )
136
+ ->with ($ request )
137
+ ->will ($ this ->returnValue (true ));
138
+
123
139
$ this
124
140
->resourceServer
125
141
->expects ($ this ->atLeastOnce ())
@@ -134,6 +150,7 @@ public function testFailAuthenticationOnExpiredToken()
134
150
135
151
public function testFailAuthenticationOnNoRequest ()
136
152
{
153
+ $ this ->resourceServer ->expects ($ this ->never ())->method ('isRequestValid ' );
137
154
$ this ->resourceServer ->expects ($ this ->never ())->method ('getAccessToken ' );
138
155
139
156
$ this ->assertFalse ($ this ->authenticationService ->hasIdentity ());
@@ -146,6 +163,7 @@ public function testFailAuthenticationOnNonHttpRequest()
146
163
147
164
$ this ->mvcEvent ->expects ($ this ->any ())->method ('getRequest ' )->will ($ this ->returnValue ($ request ));
148
165
166
+ $ this ->resourceServer ->expects ($ this ->never ())->method ('isRequestValid ' );
149
167
$ this ->resourceServer ->expects ($ this ->never ())->method ('getAccessToken ' );
150
168
151
169
$ this ->assertFalse ($ this ->authenticationService ->hasIdentity ());
0 commit comments