aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/bshaffer/oauth2-server-php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-05-19 08:18:15 +0000
committerMario <mario@mariovavti.com>2022-05-19 08:18:15 +0000
commit55d833a9c86ad9356e76bf47d0f48dd40552944a (patch)
tree4c5921be76eb249ec623aa576e2d2528537308cf /vendor/bshaffer/oauth2-server-php
parent8ba47450970bab036664f03a558917c13d8c1574 (diff)
downloadvolse-hubzilla-55d833a9c86ad9356e76bf47d0f48dd40552944a.tar.gz
volse-hubzilla-55d833a9c86ad9356e76bf47d0f48dd40552944a.tar.bz2
volse-hubzilla-55d833a9c86ad9356e76bf47d0f48dd40552944a.zip
update composer libs
Diffstat (limited to 'vendor/bshaffer/oauth2-server-php')
-rw-r--r--vendor/bshaffer/oauth2-server-php/composer.json13
-rwxr-xr-x[-rw-r--r--]vendor/bshaffer/oauth2-server-php/src/OAuth2/Storage/CouchbaseDB.php0
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php16
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/FirebaseJwtTest.php2
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/JwtTest.php2
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/GrantType/JwtBearerTest.php2
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/CodeIdTokenTest.php6
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTest.php4
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTokenTest.php2
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/ResponseTest.php2
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/ServerTest.php234
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/OAuth2/Storage/PdoTest.php8
-rw-r--r--vendor/bshaffer/oauth2-server-php/test/cleanup.php15
-rwxr-xr-x[-rw-r--r--]vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/BaseTest.php0
-rwxr-xr-x[-rw-r--r--]vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/Bootstrap.php29
15 files changed, 136 insertions, 199 deletions
diff --git a/vendor/bshaffer/oauth2-server-php/composer.json b/vendor/bshaffer/oauth2-server-php/composer.json
index 272d20027..5b763a6f1 100644
--- a/vendor/bshaffer/oauth2-server-php/composer.json
+++ b/vendor/bshaffer/oauth2-server-php/composer.json
@@ -16,15 +16,16 @@
"psr-0": { "OAuth2": "src/" }
},
"require":{
- "php":">=5.3.9"
+ "php":">=7.1"
},
"require-dev": {
- "phpunit/phpunit": "^4.0",
- "aws/aws-sdk-php": "~2.8",
- "firebase/php-jwt": "~2.2",
- "predis/predis": "dev-master",
+ "phpunit/phpunit": "^7.5||^8.0",
+ "aws/aws-sdk-php": "^2.8",
+ "firebase/php-jwt": "^2.2",
+ "predis/predis": "^1.1",
"thobbs/phpcassa": "dev-master",
- "mongodb/mongodb": "^1.1"
+ "mongodb/mongodb": "^1.1",
+ "yoast/phpunit-polyfills": "^1.0"
},
"suggest": {
"predis/predis": "Required to use Redis storage",
diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Storage/CouchbaseDB.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Storage/CouchbaseDB.php
index 9e8148b6b..9e8148b6b 100644..100755
--- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Storage/CouchbaseDB.php
+++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Storage/CouchbaseDB.php
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php
index fe3553b23..88f0d0da0 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php
@@ -133,7 +133,7 @@ class AuthorizeControllerTest extends TestCase
$server->handleAuthorizeRequest($request, $response = new Response(), true);
$this->assertEquals($response->getStatusCode(), 302);
- $this->assertNotContains('error', $response->getHttpHeader('Location'));
+ $this->assertStringNotContainsString('error', $response->getHttpHeader('Location'));
}
public function testEnforceScope()
@@ -161,7 +161,7 @@ class AuthorizeControllerTest extends TestCase
$server->handleAuthorizeRequest($request, $response = new Response(), true);
$this->assertEquals($response->getStatusCode(), 302);
- $this->assertNotContains('error', $response->getHttpHeader('Location'));
+ $this->assertStringNotContainsString('error', $response->getHttpHeader('Location'));
}
public function testInvalidRedirectUri()
@@ -227,7 +227,7 @@ class AuthorizeControllerTest extends TestCase
$server->handleAuthorizeRequest($request, $response = new Response(), true);
$this->assertEquals($response->getStatusCode(), 302);
- $this->assertContains('code', $response->getHttpHeader('Location'));
+ $this->assertStringContainsString('code', $response->getHttpHeader('Location'));
}
public function testRedirectUriWithDifferentQueryAndExactMatchRequired()
@@ -263,7 +263,7 @@ class AuthorizeControllerTest extends TestCase
$server->handleAuthorizeRequest($request, $response = new Response(), true);
$this->assertEquals($response->getStatusCode(), 302);
- $this->assertContains('code', $response->getHttpHeader('Location'));
+ $this->assertStringContainsString('code', $response->getHttpHeader('Location'));
}
public function testMultipleRedirectUris()
@@ -278,14 +278,14 @@ class AuthorizeControllerTest extends TestCase
$server->handleAuthorizeRequest($request, $response = new Response(), true);
$this->assertEquals($response->getStatusCode(), 302);
- $this->assertContains('code', $response->getHttpHeader('Location'));
+ $this->assertStringContainsString('code', $response->getHttpHeader('Location'));
// call again with different (but still valid) redirect URI
$request->query['redirect_uri'] = 'http://morehazards.com';
$server->handleAuthorizeRequest($request, $response = new Response(), true);
$this->assertEquals($response->getStatusCode(), 302);
- $this->assertContains('code', $response->getHttpHeader('Location'));
+ $this->assertStringContainsString('code', $response->getHttpHeader('Location'));
}
/**
@@ -303,7 +303,7 @@ class AuthorizeControllerTest extends TestCase
$server->handleAuthorizeRequest($request, $response = new Response(), true);
$this->assertEquals($response->getStatusCode(), 302);
- $this->assertContains('state', $response->getHttpHeader('Location'));
+ $this->assertStringContainsString('state', $response->getHttpHeader('Location'));
$this->assertStringStartsWith('http://brentertainment.com?code=', $response->getHttpHeader('Location'));
$parts = parse_url($response->getHttpHeader('Location'));
@@ -421,7 +421,7 @@ class AuthorizeControllerTest extends TestCase
$this->assertEquals($response->getStatusCode(), 302);
$location = $response->getHttpHeader('Location');
- $this->assertNotContains('error', $location);
+ $this->assertStringNotContainsString('error', $location);
$parts = parse_url($location);
$this->assertFalse(isset($parts['fake']));
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/FirebaseJwtTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/FirebaseJwtTest.php
index c7e92c053..63a5d4036 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/FirebaseJwtTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/FirebaseJwtTest.php
@@ -9,7 +9,7 @@ class FirebaseJwtTest extends TestCase
{
private $privateKey;
- public function setUp()
+ public function setUp(): void
{
$this->privateKey = <<<EOD
-----BEGIN RSA PRIVATE KEY-----
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/JwtTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/JwtTest.php
index d73b4c923..376a922b1 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/JwtTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Encryption/JwtTest.php
@@ -9,7 +9,7 @@ class JwtTest extends TestCase
{
private $privateKey;
- public function setUp()
+ public function setUp(): void
{
$this->privateKey = <<<EOD
-----BEGIN RSA PRIVATE KEY-----
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/GrantType/JwtBearerTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/GrantType/JwtBearerTest.php
index e60023b3c..4f6d67b2c 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/GrantType/JwtBearerTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/GrantType/JwtBearerTest.php
@@ -13,7 +13,7 @@ class JwtBearerTest extends TestCase
{
private $privateKey;
- public function setUp()
+ public function setUp(): void
{
$this->privateKey = <<<EOD
-----BEGIN RSA PRIVATE KEY-----
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/CodeIdTokenTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/CodeIdTokenTest.php
index 7b892c946..f08322bd4 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/CodeIdTokenTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/CodeIdTokenTest.php
@@ -29,7 +29,7 @@ class CodeIdTokenTest extends TestCase
$this->assertEquals($response->getStatusCode(), 302);
$location = $response->getHttpHeader('Location');
- $this->assertNotContains('error', $location);
+ $this->assertStringNotContainsString('error', $location);
$parts = parse_url($location);
$this->assertArrayHasKey('query', $parts);
@@ -87,7 +87,7 @@ class CodeIdTokenTest extends TestCase
$this->assertEquals($response->getStatusCode(), 302);
$location = $response->getHttpHeader('Location');
- $this->assertNotContains('error', $location);
+ $this->assertStringNotContainsString('error', $location);
$parts = parse_url($location);
$this->assertArrayHasKey('query', $parts);
@@ -133,7 +133,7 @@ class CodeIdTokenTest extends TestCase
$this->assertEquals($response->getStatusCode(), 302);
$location = $response->getHttpHeader('Location');
- $this->assertNotContains('error', $location);
+ $this->assertStringNotContainsString('error', $location);
$parts = parse_url($location);
$this->assertArrayHasKey('query', $parts);
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTest.php
index a0df3a936..85f8abc86 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTest.php
@@ -52,7 +52,7 @@ class IdTokenTest extends TestCase
$this->assertEquals($response->getStatusCode(), 302);
$location = $response->getHttpHeader('Location');
- $this->assertNotContains('error', $location);
+ $this->assertStringNotContainsString('error', $location);
$parts = parse_url($location);
$this->assertArrayHasKey('fragment', $parts);
@@ -110,7 +110,7 @@ class IdTokenTest extends TestCase
{
$this->assertEquals($response->getStatusCode(), 302);
$location = $response->getHttpHeader('Location');
- $this->assertNotContains('error', $location);
+ $this->assertStringNotContainsString('error', $location);
$parts = parse_url($location);
$this->assertArrayHasKey('fragment', $parts);
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTokenTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTokenTest.php
index 0573a9866..6d4cb14c3 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTokenTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/OpenID/ResponseType/IdTokenTokenTest.php
@@ -31,7 +31,7 @@ class IdTokenTokenTest extends TestCase
$this->assertEquals($response->getStatusCode(), 302);
$location = $response->getHttpHeader('Location');
- $this->assertNotContains('error', $location);
+ $this->assertStringNotContainsString('error', $location);
$parts = parse_url($location);
$this->assertArrayHasKey('fragment', $parts);
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/ResponseTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/ResponseTest.php
index 172bc88fd..338f5cc93 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/ResponseTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/ResponseTest.php
@@ -14,7 +14,7 @@ class ResponseTest extends TestCase
));
$string = $response->getResponseBody('xml');
- $this->assertContains('<response><foo>bar</foo><halland>oates</halland></response>', $string);
+ $this->assertStringContainsString('<response><foo>bar</foo><halland>oates</halland></response>', $string);
}
public function testSetRedirect()
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/ServerTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/ServerTest.php
index 3106961e2..fab526a6f 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/ServerTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/ServerTest.php
@@ -6,27 +6,26 @@ use OAuth2\Request\TestRequest;
use OAuth2\ResponseType\AuthorizationCode;
use OAuth2\Storage\Bootstrap;
use PHPUnit\Framework\TestCase;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectPHPException;
class ServerTest extends TestCase
{
- /**
- * @expectedException LogicException OAuth2\Storage\ClientInterface
- **/
+ use ExpectPHPException;
+
public function testGetAuthorizeControllerWithNoClientStorageThrowsException()
{
+ $this->expectExceptionMessage('OAuth2\Storage\ClientInterface');
// must set Client Storage
$server = new Server();
$server->getAuthorizeController();
}
- /**
- * @expectedException LogicException OAuth2\Storage\AccessTokenInterface
- **/
public function testGetAuthorizeControllerWithNoAccessTokenStorageThrowsException()
{
+ $this->expectExceptionMessage('OAuth2\Storage\AccessTokenInterface');
// must set AccessToken or AuthorizationCode
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\ClientInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientInterface'));
$server->getAuthorizeController();
}
@@ -34,8 +33,8 @@ class ServerTest extends TestCase
{
// must set AccessToken or AuthorizationCode
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\ClientInterface'));
- $server->addResponseType($this->getMock('OAuth2\ResponseType\AccessTokenInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientInterface'));
+ $server->addResponseType($this->createMock('OAuth2\ResponseType\AccessTokenInterface'));
$this->assertNotNull($server->getAuthorizeController());
}
@@ -44,21 +43,19 @@ class ServerTest extends TestCase
{
// must set AccessToken or AuthorizationCode
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\ClientInterface'));
- $server->addResponseType($this->getMock('OAuth2\ResponseType\AuthorizationCodeInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientInterface'));
+ $server->addResponseType($this->createMock('OAuth2\ResponseType\AuthorizationCodeInterface'));
$this->assertNotNull($server->getAuthorizeController());
}
- /**
- * @expectedException LogicException allow_implicit
- **/
public function testGetAuthorizeControllerWithClientStorageAndAccessTokenStorageThrowsException()
{
// must set AuthorizationCode or AccessToken / implicit
+ $this->expectExceptionMessage('allow_implicit');
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\ClientInterface'));
- $server->addStorage($this->getMock('OAuth2\Storage\AccessTokenInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\AccessTokenInterface'));
$this->assertNotNull($server->getAuthorizeController());
}
@@ -67,8 +64,8 @@ class ServerTest extends TestCase
{
// must set AuthorizationCode or AccessToken / implicit
$server = new Server(array(), array('allow_implicit' => true));
- $server->addStorage($this->getMock('OAuth2\Storage\ClientInterface'));
- $server->addStorage($this->getMock('OAuth2\Storage\AccessTokenInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\AccessTokenInterface'));
$this->assertNotNull($server->getAuthorizeController());
}
@@ -77,63 +74,55 @@ class ServerTest extends TestCase
{
// must set AccessToken or AuthorizationCode
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\ClientInterface'));
- $server->addStorage($this->getMock('OAuth2\Storage\AuthorizationCodeInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\AuthorizationCodeInterface'));
$this->assertNotNull($server->getAuthorizeController());
}
- /**
- * @expectedException LogicException grant_types
- **/
public function testGetTokenControllerWithGrantTypeStorageThrowsException()
{
+ $this->expectExceptionMessage('grant_types');
$server = new Server();
$server->getTokenController();
}
- /**
- * @expectedException LogicException OAuth2\Storage\ClientCredentialsInterface
- **/
public function testGetTokenControllerWithNoClientCredentialsStorageThrowsException()
{
+ $this->expectExceptionMessage('OAuth2\Storage\ClientCredentialsInterface');
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\UserCredentialsInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\UserCredentialsInterface'));
$server->getTokenController();
}
- /**
- * @expectedException LogicException OAuth2\Storage\AccessTokenInterface
- **/
public function testGetTokenControllerWithNoAccessTokenStorageThrowsException()
{
+ $this->expectExceptionMessage('OAuth2\Storage\AccessTokenInterface');
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\ClientCredentialsInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientCredentialsInterface'));
$server->getTokenController();
}
public function testGetTokenControllerWithAccessTokenAndClientCredentialsStorage()
{
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\AccessTokenInterface'));
- $server->addStorage($this->getMock('OAuth2\Storage\ClientCredentialsInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\AccessTokenInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientCredentialsInterface'));
$server->getTokenController();
}
public function testGetTokenControllerAccessTokenStorageAndClientCredentialsStorageAndGrantTypes()
{
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\AccessTokenInterface'));
- $server->addStorage($this->getMock('OAuth2\Storage\ClientCredentialsInterface'));
- $server->addGrantType($this->getMockBuilder('OAuth2\GrantType\AuthorizationCode')->disableOriginalConstructor()->getMock());
+ $server->addStorage($this->createMock('OAuth2\Storage\AccessTokenInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientCredentialsInterface'));
+ $server->addGrantType($this->createMock('OAuth2\GrantType\AuthorizationCode'));
$server->getTokenController();
}
- /**
- * @expectedException LogicException OAuth2\Storage\AccessTokenInterface
- **/
public function testGetResourceControllerWithNoAccessTokenStorageThrowsException()
{
+ $this->expectExceptionMessage('OAuth2\Storage\AccessTokenInterface');
$server = new Server();
$server->getResourceController();
}
@@ -141,41 +130,35 @@ class ServerTest extends TestCase
public function testGetResourceControllerWithAccessTokenStorage()
{
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\AccessTokenInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\AccessTokenInterface'));
$server->getResourceController();
}
- /**
- * @expectedException InvalidArgumentException OAuth2\Storage\AccessTokenInterface
- **/
public function testAddingStorageWithInvalidClass()
{
+ $this->expectExceptionMessage('OAuth2\Storage\AccessTokenInterface');
$server = new Server();
$server->addStorage(new \StdClass());
}
- /**
- * @expectedException InvalidArgumentException access_token
- **/
public function testAddingStorageWithInvalidKey()
{
+ $this->expectExceptionMessage('access_token');
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\AccessTokenInterface'), 'nonexistant_storage');
+ $server->addStorage($this->createMock('OAuth2\Storage\AccessTokenInterface'), 'nonexistant_storage');
}
- /**
- * @expectedException InvalidArgumentException OAuth2\Storage\AuthorizationCodeInterface
- **/
public function testAddingStorageWithInvalidKeyStorageCombination()
{
+ $this->expectExceptionMessage('OAuth2\Storage\AuthorizationCodeInterface');
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\AccessTokenInterface'), 'authorization_code');
+ $server->addStorage($this->createMock('OAuth2\Storage\AccessTokenInterface'), 'authorization_code');
}
public function testAddingStorageWithValidKeyOnlySetsThatKey()
{
$server = new Server();
- $server->addStorage($this->getMock('OAuth2\Storage\Memory'), 'access_token');
+ $server->addStorage($this->createMock('OAuth2\Storage\Memory'), 'access_token');
$reflection = new \ReflectionClass($server);
$prop = $reflection->getProperty('storages');
@@ -191,7 +174,7 @@ class ServerTest extends TestCase
public function testAddingClientStorageSetsClientCredentialsStorageByDefault()
{
$server = new Server();
- $memory = $this->getMock('OAuth2\Storage\Memory');
+ $memory = $this->createMock('OAuth2\Storage\Memory');
$server->addStorage($memory, 'client');
$client_credentials = $server->getStorage('client_credentials');
@@ -202,7 +185,7 @@ class ServerTest extends TestCase
public function testAddStorageWithNullValue()
{
- $memory = $this->getMock('OAuth2\Storage\Memory');
+ $memory = $this->createMock('OAuth2\Storage\Memory');
$server = new Server($memory);
$server->addStorage(null, 'refresh_token');
@@ -218,7 +201,7 @@ class ServerTest extends TestCase
public function testNewServerWithNullStorageValue()
{
- $memory = $this->getMock('OAuth2\Storage\Memory');
+ $memory = $this->createMock('OAuth2\Storage\Memory');
$server = new Server(array(
'client_credentials' => $memory,
'refresh_token' => null,
@@ -237,7 +220,7 @@ class ServerTest extends TestCase
public function testAddingClientCredentialsStorageSetsClientStorageByDefault()
{
$server = new Server();
- $memory = $this->getMock('OAuth2\Storage\Memory');
+ $memory = $this->createMock('OAuth2\Storage\Memory');
$server->addStorage($memory, 'client_credentials');
$client = $server->getStorage('client');
@@ -249,10 +232,9 @@ class ServerTest extends TestCase
public function testSettingClientStorageByDefaultDoesNotOverrideSetStorage()
{
$server = new Server();
- $pdo = $this->getMockBuilder('OAuth2\Storage\Pdo')
- ->disableOriginalConstructor()->getMock();
+ $pdo = $this->createMock('OAuth2\Storage\Pdo');
- $memory = $this->getMock('OAuth2\Storage\Memory');
+ $memory = $this->createMock('OAuth2\Storage\Memory');
$server->addStorage($pdo, 'client');
$server->addStorage($memory, 'client_credentials');
@@ -266,7 +248,7 @@ class ServerTest extends TestCase
public function testAddingResponseType()
{
- $storage = $this->getMock('OAuth2\Storage\Memory');
+ $storage = $this->createMock('OAuth2\Storage\Memory');
$storage
->expects($this->any())
->method('getClientDetails')
@@ -323,7 +305,7 @@ class ServerTest extends TestCase
'code' => 'testcode',
));
// verify the mock clientAssertionType was called as expected
- $clientAssertionType = $this->getMock('OAuth2\ClientAssertionType\ClientAssertionTypeInterface', array('validateRequest', 'getClientId'));
+ $clientAssertionType = $this->createMock('OAuth2\ClientAssertionType\ClientAssertionTypeInterface');
$clientAssertionType
->expects($this->once())
->method('validateRequest')
@@ -420,98 +402,84 @@ class ServerTest extends TestCase
$this->assertFalse($used_token, 'the refresh token used is no longer valid');
}
- /**
- * @expectedException InvalidArgumentException OAuth2\ResponseType\AuthorizationCodeInterface
- **/
public function testAddingUnknownResponseTypeThrowsException()
{
+ $this->expectExceptionMessage('OAuth2\ResponseType\AuthorizationCodeInterface');
$server = new Server();
- $server->addResponseType($this->getMock('OAuth2\ResponseType\ResponseTypeInterface'));
+ $server->addResponseType($this->createMock('OAuth2\ResponseType\ResponseTypeInterface'));
}
- /**
- * @expectedException LogicException OAuth2\Storage\PublicKeyInterface
- **/
public function testUsingJwtAccessTokensWithoutPublicKeyStorageThrowsException()
{
+ $this->expectExceptionMessage('OAuth2\Storage\PublicKeyInterface');
$server = new Server(array(), array('use_jwt_access_tokens' => true));
- $server->addGrantType($this->getMock('OAuth2\GrantType\GrantTypeInterface'));
- $server->addStorage($this->getMock('OAuth2\Storage\ClientCredentialsInterface'));
- $server->addStorage($this->getMock('OAuth2\Storage\ClientCredentialsInterface'));
+ $server->addGrantType($this->createMock('OAuth2\GrantType\GrantTypeInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientCredentialsInterface'));
+ $server->addStorage($this->createMock('OAuth2\Storage\ClientCredentialsInterface'));
$server->getTokenController();
}
public function testUsingJustJwtAccessTokenStorageWithResourceControllerIsOkay()
{
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
$server = new Server(array($pubkey), array('use_jwt_access_tokens' => true));
$this->assertNotNull($server->getResourceController());
$this->assertInstanceOf('OAuth2\Storage\PublicKeyInterface', $server->getStorage('public_key'));
}
- /**
- * @expectedException LogicException OAuth2\Storage\ClientInterface
- **/
public function testUsingJustJwtAccessTokenStorageWithAuthorizeControllerThrowsException()
{
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
+ $this->expectExceptionMessage('OAuth2\Storage\ClientInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
$server = new Server(array($pubkey), array('use_jwt_access_tokens' => true));
$this->assertNotNull($server->getAuthorizeController());
}
- /**
- * @expectedException LogicException grant_types
- **/
public function testUsingJustJwtAccessTokenStorageWithTokenControllerThrowsException()
{
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
+ $this->expectExceptionMessage('grant_types');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
$server = new Server(array($pubkey), array('use_jwt_access_tokens' => true));
$server->getTokenController();
}
public function testUsingJwtAccessTokenAndClientStorageWithAuthorizeControllerIsOkay()
{
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
$server = new Server(array($pubkey, $client), array('use_jwt_access_tokens' => true, 'allow_implicit' => true));
$this->assertNotNull($server->getAuthorizeController());
$this->assertInstanceOf('OAuth2\ResponseType\JwtAccessToken', $server->getResponseType('token'));
}
- /**
- * @expectedException LogicException UserClaims
- **/
public function testUsingOpenIDConnectWithoutUserClaimsThrowsException()
{
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
+ $this->expectExceptionMessage('UserClaims');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
$server = new Server($client, array('use_openid_connect' => true));
$server->getAuthorizeController();
}
- /**
- * @expectedException LogicException PublicKeyInterface
- **/
public function testUsingOpenIDConnectWithoutPublicKeyThrowsException()
{
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
- $userclaims = $this->getMock('OAuth2\OPenID\Storage\UserClaimsInterface');
+ $this->expectExceptionMessage('PublicKeyInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
+ $userclaims = $this->createMock('OAuth2\OPenID\Storage\UserClaimsInterface');
$server = new Server(array($client, $userclaims), array('use_openid_connect' => true));
$server->getAuthorizeController();
}
- /**
- * @expectedException LogicException issuer
- **/
public function testUsingOpenIDConnectWithoutIssuerThrowsException()
{
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
- $userclaims = $this->getMock('OAuth2\OpenID\Storage\UserClaimsInterface');
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
+ $this->expectExceptionMessage('issuer');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
+ $userclaims = $this->createMock('OAuth2\OpenID\Storage\UserClaimsInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
$server = new Server(array($client, $userclaims, $pubkey), array('use_openid_connect' => true));
$server->getAuthorizeController();
@@ -519,9 +487,9 @@ class ServerTest extends TestCase
public function testUsingOpenIDConnectWithIssuerPublicKeyAndUserClaimsIsOkay()
{
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
- $userclaims = $this->getMock('OAuth2\OpenID\Storage\UserClaimsInterface');
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
+ $userclaims = $this->createMock('OAuth2\OpenID\Storage\UserClaimsInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
$server = new Server(array($client, $userclaims, $pubkey), array(
'use_openid_connect' => true,
'issuer' => 'someguy',
@@ -533,14 +501,12 @@ class ServerTest extends TestCase
$this->assertNull($server->getResponseType('id_token token'));
}
- /**
- * @expectedException LogicException OAuth2\ResponseType\AccessTokenInterface
- **/
public function testUsingOpenIDConnectWithAllowImplicitWithoutTokenStorageThrowsException()
{
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
- $userclaims = $this->getMock('OAuth2\OpenID\Storage\UserClaimsInterface');
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
+ $this->expectErrorMessage('OAuth2\ResponseType\AccessTokenInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
+ $userclaims = $this->createMock('OAuth2\OpenID\Storage\UserClaimsInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
$server = new Server(array($client, $userclaims, $pubkey), array(
'use_openid_connect' => true,
'issuer' => 'someguy',
@@ -552,9 +518,9 @@ class ServerTest extends TestCase
public function testUsingOpenIDConnectWithAllowImplicitAndUseJwtAccessTokensIsOkay()
{
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
- $userclaims = $this->getMock('OAuth2\OpenID\Storage\UserClaimsInterface');
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
+ $userclaims = $this->createMock('OAuth2\OpenID\Storage\UserClaimsInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
$server = new Server(array($client, $userclaims, $pubkey), array(
'use_openid_connect' => true,
'issuer' => 'someguy',
@@ -570,10 +536,10 @@ class ServerTest extends TestCase
public function testUsingOpenIDConnectWithAllowImplicitAndAccessTokenStorageIsOkay()
{
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
- $userclaims = $this->getMock('OAuth2\OpenID\Storage\UserClaimsInterface');
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
- $token = $this->getMock('OAuth2\Storage\AccessTokenInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
+ $userclaims = $this->createMock('OAuth2\OpenID\Storage\UserClaimsInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
+ $token = $this->createMock('OAuth2\Storage\AccessTokenInterface');
$server = new Server(array($client, $userclaims, $pubkey, $token), array(
'use_openid_connect' => true,
'issuer' => 'someguy',
@@ -588,17 +554,17 @@ class ServerTest extends TestCase
public function testUsingOpenIDConnectWithAllowImplicitAndAccessTokenResponseTypeIsOkay()
{
- $client = $this->getMock('OAuth2\Storage\ClientInterface');
- $userclaims = $this->getMock('OAuth2\OpenID\Storage\UserClaimsInterface');
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
- // $token = $this->getMock('OAuth2\Storage\AccessTokenInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientInterface');
+ $userclaims = $this->createMock('OAuth2\OpenID\Storage\UserClaimsInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
+ // $token = $this->createMock('OAuth2\Storage\AccessTokenInterface');
$server = new Server(array($client, $userclaims, $pubkey), array(
'use_openid_connect' => true,
'issuer' => 'someguy',
'allow_implicit' => true,
));
- $token = $this->getMock('OAuth2\ResponseType\AccessTokenInterface');
+ $token = $this->createMock('OAuth2\ResponseType\AccessTokenInterface');
$server->addResponseType($token, 'token');
$server->getAuthorizeController();
@@ -607,17 +573,15 @@ class ServerTest extends TestCase
$this->assertInstanceOf('OAuth2\OpenID\ResponseType\IdTokenTokenInterface', $server->getResponseType('id_token token'));
}
- /**
- * @expectedException LogicException OAuth2\OpenID\Storage\AuthorizationCodeInterface
- **/
public function testUsingOpenIDConnectWithAuthorizationCodeStorageThrowsException()
{
- $client = $this->getMock('OAuth2\Storage\ClientCredentialsInterface');
- $userclaims = $this->getMock('OAuth2\OpenID\Storage\UserClaimsInterface');
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
- $token = $this->getMock('OAuth2\Storage\AccessTokenInterface');
- $authcode = $this->getMock('OAuth2\Storage\AuthorizationCodeInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientCredentialsInterface');
+ $userclaims = $this->createMock('OAuth2\OpenID\Storage\UserClaimsInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
+ $token = $this->createMock('OAuth2\Storage\AccessTokenInterface');
+ $authcode = $this->createMock('OAuth2\Storage\AuthorizationCodeInterface');
+ $this->expectErrorMessage('OAuth2\OpenID\Storage\AuthorizationCodeInterface');
$server = new Server(array($client, $userclaims, $pubkey, $token, $authcode), array(
'use_openid_connect' => true,
'issuer' => 'someguy'
@@ -630,11 +594,11 @@ class ServerTest extends TestCase
public function testUsingOpenIDConnectWithOpenIDAuthorizationCodeStorageCreatesOpenIDAuthorizationCodeGrantType()
{
- $client = $this->getMock('OAuth2\Storage\ClientCredentialsInterface');
- $userclaims = $this->getMock('OAuth2\OpenID\Storage\UserClaimsInterface');
- $pubkey = $this->getMock('OAuth2\Storage\PublicKeyInterface');
- $token = $this->getMock('OAuth2\Storage\AccessTokenInterface');
- $authcode = $this->getMock('OAuth2\OpenID\Storage\AuthorizationCodeInterface');
+ $client = $this->createMock('OAuth2\Storage\ClientCredentialsInterface');
+ $userclaims = $this->createMock('OAuth2\OpenID\Storage\UserClaimsInterface');
+ $pubkey = $this->createMock('OAuth2\Storage\PublicKeyInterface');
+ $token = $this->createMock('OAuth2\Storage\AccessTokenInterface');
+ $authcode = $this->createMock('OAuth2\OpenID\Storage\AuthorizationCodeInterface');
$server = new Server(array($client, $userclaims, $pubkey, $token, $authcode), array(
'use_openid_connect' => true,
@@ -648,7 +612,7 @@ class ServerTest extends TestCase
public function testMultipleValuedResponseTypeOrderDoesntMatter()
{
- $responseType = $this->getMock('OAuth2\OpenID\ResponseType\IdTokenTokenInterface');
+ $responseType = $this->createMock('OAuth2\OpenID\ResponseType\IdTokenTokenInterface');
$server = new Server(array(), array(), array(), array(
'token id_token' => $responseType,
));
@@ -659,7 +623,7 @@ class ServerTest extends TestCase
public function testAddGrantTypeWithoutKey()
{
$server = new Server();
- $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->getMock('OAuth2\Storage\AuthorizationCodeInterface')));
+ $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->createMock('OAuth2\Storage\AuthorizationCodeInterface')));
$grantTypes = $server->getGrantTypes();
$this->assertEquals('authorization_code', key($grantTypes));
@@ -668,7 +632,7 @@ class ServerTest extends TestCase
public function testAddGrantTypeWithKey()
{
$server = new Server();
- $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->getMock('OAuth2\Storage\AuthorizationCodeInterface')), 'ac');
+ $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->createMock('OAuth2\Storage\AuthorizationCodeInterface')), 'ac');
$grantTypes = $server->getGrantTypes();
$this->assertEquals('ac', key($grantTypes));
@@ -677,7 +641,7 @@ class ServerTest extends TestCase
public function testAddGrantTypeWithKeyNotString()
{
$server = new Server();
- $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->getMock('OAuth2\Storage\AuthorizationCodeInterface')), 42);
+ $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->createMock('OAuth2\Storage\AuthorizationCodeInterface')), 42);
$grantTypes = $server->getGrantTypes();
$this->assertEquals('authorization_code', key($grantTypes));
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Storage/PdoTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Storage/PdoTest.php
index 4599f69bf..9a7630423 100644
--- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Storage/PdoTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Storage/PdoTest.php
@@ -2,8 +2,12 @@
namespace OAuth2\Storage;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectPHPException;
+
class PdoTest extends BaseTest
{
+ use ExpectPHPException;
+
public function testCreatePdoStorageUsingPdoClass()
{
$dsn = sprintf('sqlite:%s', Bootstrap::getInstance()->getSqliteDir());
@@ -30,11 +34,9 @@ class PdoTest extends BaseTest
$this->assertNotNull($storage->getClientDetails('oauth_test_client'));
}
- /**
- * @expectedException InvalidArgumentException dsn
- */
public function testCreatePdoStorageWithoutDSNThrowsException()
{
+ $this->expectErrorMessage('dsn');
$config = array('username' => 'brent', 'password' => 'brentisaballer');
$storage = new Pdo($config);
}
diff --git a/vendor/bshaffer/oauth2-server-php/test/cleanup.php b/vendor/bshaffer/oauth2-server-php/test/cleanup.php
deleted file mode 100644
index 8663a901b..000000000
--- a/vendor/bshaffer/oauth2-server-php/test/cleanup.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-require_once(dirname(__FILE__).'/../src/OAuth2/Autoloader.php');
-OAuth2\Autoloader::register();
-
-// register test classes
-OAuth2\Autoloader::register(dirname(__FILE__).'/lib');
-
-// register vendors if possible
-if (file_exists(__DIR__.'/../vendor/autoload.php')) {
- require_once(__DIR__.'/../vendor/autoload.php');
-}
-
-// remove the dynamoDB database that was created for this build
-OAuth2\Storage\Bootstrap::getInstance()->cleanupTravisDynamoDb();
diff --git a/vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/BaseTest.php b/vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/BaseTest.php
index e841d3ad2..e841d3ad2 100644..100755
--- a/vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/BaseTest.php
+++ b/vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/BaseTest.php
diff --git a/vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/Bootstrap.php b/vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/Bootstrap.php
index 8e428f9b5..66c93ae5b 100644..100755
--- a/vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/Bootstrap.php
+++ b/vendor/bshaffer/oauth2-server-php/test/lib/OAuth2/Storage/Bootstrap.php
@@ -68,7 +68,7 @@ class Bootstrap
public function getPostgresDriver()
{
try {
- $pdo = new \PDO('pgsql:host=localhost;dbname=oauth2_server_php', 'postgres');
+ $pdo = new \PDO('pgsql:host=localhost;dbname=oauth2_server_php', 'postgres', 'postgres');
return $pdo;
} catch (\PDOException $e) {
@@ -118,7 +118,7 @@ class Bootstrap
if (!$this->mysql) {
$pdo = null;
try {
- $pdo = new \PDO('mysql:host=localhost;', 'root');
+ $pdo = new \PDO('mysql:host=localhost;', 'root', 'root');
} catch (\PDOException $e) {
$this->mysql = new NullStorage('MySQL', 'Unable to connect to MySQL on root@localhost');
}
@@ -352,11 +352,11 @@ class Bootstrap
private function createPostgresDb()
{
- if (!`psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='postgres'"`) {
- `createuser -s -r postgres`;
+ if (!`PGPASSWORD=postgres psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='postgres'" -h localhost -U postgres`) {
+ `PGPASSWORD=postgres createuser -s -r postgres -h localhost -U postgres`;
}
- `createdb -O postgres oauth2_server_php`;
+ `PGPASSWORD=postgres createdb -O postgres oauth2_server_php -h localhost -U postgres`;
}
private function populatePostgresDb(\PDO $pdo)
@@ -366,8 +366,8 @@ class Bootstrap
private function removePostgresDb()
{
- if (trim(`psql -l | grep oauth2_server_php | wc -l`)) {
- `dropdb oauth2_server_php`;
+ if (trim(`PGPASSWORD=postgres psql -l -h localhost -U postgres | grep oauth2_server_php | wc -l`)) {
+ `PGPASSWORD=postgres dropdb oauth2_server_php -h localhost -U postgres`;
}
}
@@ -945,21 +945,6 @@ class Bootstrap
));
}
- public function cleanupTravisDynamoDb($prefix = null)
- {
- if (is_null($prefix)) {
- // skip this when not applicable
- if (!$this->getEnvVar('TRAVIS') || self::DYNAMODB_PHP_VERSION != $this->getEnvVar('TRAVIS_PHP_VERSION')) {
- return;
- }
-
- $prefix = sprintf('build_%s_', $this->getEnvVar('TRAVIS_JOB_NUMBER'));
- }
-
- $client = $this->getDynamoDbClient();
- $this->deleteDynamoDb($client, $prefix);
- }
-
private function getEnvVar($var, $default = null)
{
return isset($_SERVER[$var]) ? $_SERVER[$var] : (getenv($var) ?: $default);