6
6
/**
7
7
* OAuth2 test case.
8
8
*/
9
- class OAuth2Test extends PHPUnit_Extensions_OutputTestCase {
9
+ class OAuth2Test extends PHPUnit_Framework_TestCase {
10
10
11
11
/**
12
12
* @var OAuth2
@@ -19,22 +19,6 @@ class OAuth2Test extends PHPUnit_Extensions_OutputTestCase {
19
19
*/
20
20
private $ tokenId = 'my_token ' ;
21
21
22
- /**
23
- * Prepares the environment before running a test.
24
- */
25
- protected function setUp () {
26
- parent ::setUp ();
27
- // $this->fixture = new OAuth2(/* parameters */);
28
- }
29
-
30
- /**
31
- * Cleans up the environment after running a test.
32
- */
33
- protected function tearDown () {
34
- $ this ->fixture = null ;
35
- parent ::tearDown ();
36
- }
37
-
38
22
/**
39
23
* Tests OAuth2->verifyAccessToken() with a missing token
40
24
*/
@@ -143,7 +127,7 @@ public function testVerifyAccessTokenCheckScope($scopeRequired, $token, $expecte
143
127
}
144
128
145
129
/**
146
- * Tests OAuth2->grantAccessToken()
130
+ * Tests OAuth2->grantAccessToken() for missing data
147
131
*
148
132
* @dataProvider generateEmptyDataForGrant
149
133
*/
@@ -158,7 +142,7 @@ public function testGrantAccessTokenMissingData($inputData, $authHeaders) {
158
142
/**
159
143
* Tests OAuth2->grantAccessToken()
160
144
*
161
- * Tests the different ways a client credentials can be provided.
145
+ * Tests the different ways client credentials can be provided.
162
146
*/
163
147
public function testGrantAccessTokenCheckClientCredentials () {
164
148
$ mockStorage = $ this ->getMock ('IOAuth2Storage ' );
@@ -170,7 +154,7 @@ public function testGrantAccessTokenCheckClientCredentials() {
170
154
$ inputData = array ('grant_type ' => OAuth2::GRANT_TYPE_AUTH_CODE );
171
155
$ authHeaders = array ();
172
156
173
- // First, confirm that an non client related error is thrown:
157
+ // First, confirm that an non- client related error is thrown:
174
158
try {
175
159
$ this ->fixture ->grantAccessToken ($ inputData , $ authHeaders );
176
160
$ this ->fail ('The expected exception OAuth2ServerException was not thrown ' );
@@ -254,25 +238,6 @@ public function testGrantAccessTokenWithGrantAuthCodeNoToken() {
254
238
}
255
239
}
256
240
257
- /**
258
- * Tests OAuth2->grantAccessToken() with successful Auth code grant
259
- *
260
- */
261
- public function testGrantAccessTokenWithGrantAuthCodeSuccess () {
262
- $ inputData = array ('grant_type ' => OAuth2::GRANT_TYPE_AUTH_CODE , 'redirect_uri ' => 'http://www.example.com/my/subdir ' , 'client_id ' => 'my_little_app ' , 'client_secret ' => 'b ' , 'code ' => 'foo ' );
263
- $ storedToken = array ('redirect_uri ' => 'http://www.example.com ' , 'client_id ' => 'my_little_app ' , 'expires ' => time () + 60 );
264
-
265
- $ mockStorage = $ this ->createBaseMock ('IOAuth2GrantCode ' );
266
- $ mockStorage ->expects ($ this ->any ())
267
- ->method ('getAuthCode ' )
268
- ->will ($ this ->returnValue ($ storedToken ));
269
-
270
- // Successful token grant will return a JSON encoded token:
271
- $ this ->expectOutputRegex ('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/ ' );
272
- $ this ->fixture = new OAuth2 ($ mockStorage );
273
- $ this ->fixture ->grantAccessToken ($ inputData , array (), FALSE );
274
- }
275
-
276
241
/**
277
242
* Tests OAuth2->grantAccessToken() with checks the redirect URI
278
243
*
0 commit comments