I have a few PHPUnit tests in my project, and some of them use the @expectedException feature, as shown below.
/**
* @expectedException League\OAuth2\Client\Provider\Exception\IdentityProviderException
**/
public function testExceptionThrownWhenErrorObjectReceived()
{
...
}
/**
* @expectedException League\OAuth2\Client\Provider\Exception\IdentityProviderException
**/
public function testExceptionThrownWhenOAuthErrorReceived()
{
...
}
/**
* @expectedException UnexpectedValueException
**/
public function testExceptionThrownWhenAskingForResourceOwner()
{
...
}
I run them with the help of travis under PHP 5.6, 7.0, 7.1 and 7.2 without problem, but HHVM fails :
There were 3 errors:
1) Mrjoops\OAuth2\Client\Test\Provider\JiraTest::testExceptionThrownWhenErrorObjectReceived
Mrjoops\OAuth2\Client\Provider\Exception\JiraIdentityProviderException: Validation Failed
2) Mrjoops\OAuth2\Client\Test\Provider\JiraTest::testExceptionThrownWhenOAuthErrorReceived
Mrjoops\OAuth2\Client\Provider\Exception\JiraIdentityProviderException: error_collection
3) Mrjoops\OAuth2\Client\Test\Provider\JiraTest::testExceptionThrownWhenAskingForResourceOwner
UnexpectedValueException: Invalid response received from Authorization Server. Expected JSON.
I use the latest PHPUnit 5.7 version (for PHP 5.6 compatibility) and the latest HHVM 3.29.1.
Travis wrote on their website about this :
Please note that if you want to run PHPUnit on HHVM, you have to explicitly install version 5.7 in your .travis.yml due to a compatibility issue between HHVM and PHP7
So I suppose I'm OK.
I know there is a known issue (https://github.com/sebastianbergmann/phpunit/issues/1640) which was unresolved and closed in PHPUnit, and an inconsistency documented in HHVM (https://github.com/hhvm/user-documentation/blob/master/guides/hhvm/06-inconsistencies/03-classes-and-objects.md), but it's not clear to me if a workaround exists.
Details available here :
- Test file : https://github.com/mrjoops/oauth2-jira/blob/develop/test/src/Provider/JiraTest.php
- Travis build : https://travis-ci.org/mrjoops/oauth2-jira/jobs/452936060
Thank you in advance for your help.