Skip to content

Commit b37dd31

Browse files
authored
Merge pull request #92 from stloyd/patch-2
Adjust composer.json file to allow usage of PHP 7
2 parents a41fef6 + 2b2550a commit b37dd31

File tree

6 files changed

+53
-61
lines changed

6 files changed

+53
-61
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor/
22
composer.lock
3+
phpunit.xml

.gitmodules

Lines changed: 0 additions & 6 deletions
This file was deleted.

composer.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,29 @@
1515
"homepage": "https://github.com/FriendsOfSymfony/oauth2-php/contributors"
1616
}
1717
],
18+
1819
"require": {
1920
"php": "^5.5.9|>=7.0.8",
2021
"symfony/http-foundation": "~3.0|~4.0"
2122
},
2223
"require-dev": {
23-
"phpunit/phpunit": "~4.0"
24+
"phpunit/phpunit": "^4.8 || ^5.0"
2425
},
26+
2527
"autoload": {
26-
"psr-4": { "OAuth2\\": "lib/" }
28+
"psr-4": {
29+
"OAuth2\\": "lib/"
30+
},
31+
"exclude-from-classmap": [
32+
"/tests/"
33+
]
2734
},
2835
"autoload-dev": {
29-
"psr-4": { "OAuth2\\Tests\\": "tests/" }
36+
"psr-4": {
37+
"OAuth2\\Tests\\": "tests/"
38+
}
3039
},
40+
3141
"extra": {
3242
"branch-alias": {
3343
"dev-master": "1.2.x-dev"

tests/OAuth2ImplicitGrantTypeTest.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,12 @@
1111
*/
1212
class OAuth2ImplicitGrantTypeTest extends PHPUnit_Framework_TestCase
1313
{
14-
/**
15-
* The actual token ID is irrelevant, so choose one:
16-
* @var string
17-
*/
18-
private $tokenId = 'my_token';
19-
2014
/**
2115
* Tests OAuth2->grantAccessToken() with implicit
2216
*
2317
*/
2418
public function testGrantAccessTokenWithGrantImplicit()
2519
{
26-
//$this->fixture->grantAccessToken(/* parameters */);
27-
2820
$stub = new OAuth2ImplicitStub();
2921
$stub->addClient(new OAuth2Client('blah', 'foo', array('http://www.example.com/')));
3022
$oauth2 = new OAuth2($stub);
@@ -56,7 +48,7 @@ public function testRejectedAccessTokenWithGrantImplicit()
5648
$data = new \stdClass();
5749

5850
try {
59-
$response = $oauth2->finishClientAuthorization(false, $data, new Request(array(
51+
$oauth2->finishClientAuthorization(false, $data, new Request(array(
6052
'client_id' => 'blah',
6153
'redirect_uri' => 'http://www.example.com/?foo=bar',
6254
'state' => '42',

tests/OAuth2OutputTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Symfony\Component\HttpFoundation\Request;
77

88
/**
9-
* OAuth2 test cases that invovle capturing output.
9+
* OAuth2 test cases that involve capturing output.
1010
*/
1111
class OAuth2OutputTest extends PHPUnit_Framework_TestCase
1212
{
@@ -35,7 +35,7 @@ public function testGrantAccessTokenWithGrantAuthCodeSuccess()
3535
$response = $this->fixture->grantAccessToken($request);
3636

3737
// Successful token grant will return a JSON encoded token:
38-
$this->assertRegexp('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/', $response->getContent());
38+
$this->assertRegExp('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/', $response->getContent());
3939
}
4040

4141
/**
@@ -58,7 +58,7 @@ public function testGrantAccessTokenWithGrantAuthCodeSuccessWithoutRedirect()
5858
$response = $this->fixture->grantAccessToken($request);
5959

6060
// Successful token grant will return a JSON encoded token:
61-
$this->assertRegexp('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/', $response->getContent());
61+
$this->assertRegExp('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/', $response->getContent());
6262
}
6363

6464
// Utility methods
@@ -71,7 +71,7 @@ protected function createBaseMock($interfaceName)
7171
{
7272
$client = new OAuth2Client('my_little_app');
7373

74-
$mockStorage = $this->getMock($interfaceName);
74+
$mockStorage = $this->getMockBuilder($interfaceName)->getMock();
7575
$mockStorage->expects($this->any())
7676
->method('getClient')
7777
->will($this->returnCallback(function ($id) use ($client) {
@@ -88,5 +88,4 @@ protected function createBaseMock($interfaceName)
8888

8989
return $mockStorage;
9090
}
91-
9291
}

0 commit comments

Comments
 (0)