Skip to content

Commit

Permalink
Skip test in HHVM < 3.8
Browse files Browse the repository at this point in the history
HHVM < 3.8 has a bug in its Reflection API that breaks the behavior of
`getMockForAbstractClass()` ([see phpunit-mock-objects #223](sebastianbergmann/phpunit-mock-objects#223)).
  • Loading branch information
weierophinney committed Jul 6, 2015
1 parent cac71d7 commit aae95ae
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions test/Factory/OAuth2ServerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ protected function setUp()
parent::setUp();
}

protected function getMockForInterface($interface)
{
return $this->getMockBuilder($interface)
->disableOriginalConstructor()
->setMethods(array())
->getMockForAbstractClass();
}

/**
* @expectedException \ZF\OAuth2\Controller\Exception\RuntimeException
*/
Expand Down Expand Up @@ -191,16 +183,20 @@ public function testServiceCreatedWithOverriddenValuesInOptionsSubArray()

public function testServiceCreatedWithStoragesAsArray()
{
if (defined('HHVM_VERSION') && version_compare(constant('HHVM_VERSION'), '3.8', 'lt')) {
$this->markTestSkipped('Skipping test until we have HHVM 3.8 support');
}

$storage = array(
'access_token' => $this->getMockForInterface('OAuth2\Storage\AccessTokenInterface'),
'authorization_code' => $this->getMockForInterface('OAuth2\Storage\AuthorizationCodeInterface'),
'client_credentials' => $this->getMockForInterface('OAuth2\Storage\ClientCredentialsInterface'),
'client' => $this->getMockForInterface('OAuth2\Storage\ClientInterface'),
'refresh_token' => $this->getMockForInterface('OAuth2\Storage\RefreshTokenInterface'),
'user_credentials' => $this->getMockForInterface('OAuth2\Storage\UserCredentialsInterface'),
'public_key' => $this->getMockForInterface('OAuth2\Storage\PublicKeyInterface'),
'jwt_bearer' => $this->getMockForInterface('OAuth2\Storage\JWTBearerInterface'),
'scope' => $this->getMockForInterface('OAuth2\Storage\ScopeInterface'),
'access_token' => $this->getMockForAbstractClass('OAuth2\Storage\AccessTokenInterface'),
'authorization_code' => $this->getMockForAbstractClass('OAuth2\Storage\AuthorizationCodeInterface'),
'client_credentials' => $this->getMockForAbstractClass('OAuth2\Storage\ClientCredentialsInterface'),
'client' => $this->getMockForAbstractClass('OAuth2\Storage\ClientInterface'),
'refresh_token' => $this->getMockForAbstractClass('OAuth2\Storage\RefreshTokenInterface'),
'user_credentials' => $this->getMockForAbstractClass('OAuth2\Storage\UserCredentialsInterface'),
'public_key' => $this->getMockForAbstractClass('OAuth2\Storage\PublicKeyInterface'),
'jwt_bearer' => $this->getMockForAbstractClass('OAuth2\Storage\JWTBearerInterface'),
'scope' => $this->getMockForAbstractClass('OAuth2\Storage\ScopeInterface'),
);

$this->services->setService('OAuth2\Storage\AccessToken', $storage['access_token']);
Expand Down

0 comments on commit aae95ae

Please sign in to comment.