Skip to content

Commit

Permalink
Fix unit tests on PHP 7.0
Browse files Browse the repository at this point in the history
Use PHPUnit 5.7.21+ on PHP 5.6, and PHPUnit 6.0+ on PHP 7.0+
  • Loading branch information
soren121 committed Oct 8, 2017
1 parent 24c5b24 commit 30e862e
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: php
php:
- 5.5
- 5.6
- 7.0
- 7.1
before_script: composer install
script: phpunit
script: vendor/bin/phpunit

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"guzzlehttp/guzzle": "~6.0"
},
"require-dev": {
"phpunit/phpunit": "4.6.*"
"phpunit/phpunit": "^5.7.21|^6.0"
},
"autoload": {
"psr-4": { "Choccybiccy\\": "src/" }
Expand Down
8 changes: 4 additions & 4 deletions tests/HumanApi/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class ApplicationTest
* @package Choccybiccy\HumanApi
*/
class ApplicationTest extends \PHPUnit_Framework_TestCase
class ApplicationTest extends \PHPUnit\Framework\TestCase
{

use ReflectionMethods;
Expand Down Expand Up @@ -80,7 +80,7 @@ public function testBatchThrowsExceptionWhenUsingUnsupportedEndpoint()
{

$application = $this->getMockApplication();
$this->setExpectedException('Choccybiccy\HumanApi\Exception\UnsupportedBatchEndpointException');
$this->expectException('Choccybiccy\HumanApi\Exception\UnsupportedBatchEndpointException');
$application->batch("thisEndpointDoesntExist");

}
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testDeleteUserById($statusCode = 204)
*/
public function testDeleteUserThrowsExceptionWhenWrongErrorCode()
{
$this->setExpectedException('\Choccybiccy\HumanApi\Exception\UnexpectedResponseException');
$this->expectException('\Choccybiccy\HumanApi\Exception\UnexpectedResponseException');
$this->testDeleteUserById(500);
}

Expand Down Expand Up @@ -246,7 +246,7 @@ public function testDeleteUserThrowsExceptionWhenUnexpectedResponse()
)
->willThrowException($exception);

$this->setExpectedException('\Choccybiccy\HumanApi\Exception\UnexpectedResponseException');
$this->expectException('\Choccybiccy\HumanApi\Exception\UnexpectedResponseException');
$application->deleteUserById($humanId);

}
Expand Down
2 changes: 1 addition & 1 deletion tests/HumanApi/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class AuthTest
* @package Choccybiccy\HumanApi
*/
class AuthTest extends \PHPUnit_Framework_TestCase
class AuthTest extends \PHPUnit\Framework\TestCase
{

use ReflectionMethods;
Expand Down
2 changes: 1 addition & 1 deletion tests/HumanApi/Endpoint/LocationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class LocationsTest
* @package Choccybiccy\HumanApi\Endpoint
*/
class LocationsTest extends \PHPUnit_Framework_TestCase
class LocationsTest extends \PHPUnit\Framework\TestCase
{

use ReflectionMethods;
Expand Down
2 changes: 1 addition & 1 deletion tests/HumanApi/Endpoint/MeasurementEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class MeasurementEndpointTest
* @package Choccybiccy\HumanApi\Endpoint
*/
class MeasurementEndpointTest extends \PHPUnit_Framework_TestCase
class MeasurementEndpointTest extends \PHPUnit\Framework\TestCase
{

use ReflectionMethods;
Expand Down
2 changes: 1 addition & 1 deletion tests/HumanApi/Endpoint/PeriodicEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class PeriodicEndpointTest
* @package Choccybiccy\HumanApi\Endpoint
*/
class PeriodicEndpointTest extends \PHPUnit_Framework_TestCase
class PeriodicEndpointTest extends \PHPUnit\Framework\TestCase
{

use ReflectionMethods;
Expand Down
6 changes: 3 additions & 3 deletions tests/HumanApi/Endpoint/SimpleEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class SimpleEndpointTest
* @package Choccybiccy\HumanApi\Endpoint
*/
class SimpleEndpointTest extends \PHPUnit_Framework_TestCase
class SimpleEndpointTest extends \PHPUnit\Framework\TestCase
{

use ReflectionMethods;
Expand Down Expand Up @@ -44,7 +44,7 @@ public function testBuildSpecificEntryUrlThrowsUnsuportedException()
->disableOriginalConstructor()
->getMock();

$this->setExpectedException('Choccybiccy\HumanApi\Exception\UnsupportedEndpointMethodException');
$this->expectException('Choccybiccy\HumanApi\Exception\UnsupportedEndpointMethodException');
$this->runProtectedMethod($simple, "buildSpecificEntryUrl", array(1));

}
Expand All @@ -60,7 +60,7 @@ public function testBuildRecentUrlThrowsUnsuportedException()
->disableOriginalConstructor()
->getMock();

$this->setExpectedException('Choccybiccy\HumanApi\Exception\UnsupportedEndpointMethodException');
$this->expectException('Choccybiccy\HumanApi\Exception\UnsupportedEndpointMethodException');
$this->runProtectedMethod($simple, "buildRecentUrl", array(1));

}
Expand Down
2 changes: 1 addition & 1 deletion tests/HumanApi/EndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class EndpointTest
* @package Choccybiccy\HumanApi
*/
class EndpointTest extends \PHPUnit_Framework_TestCase
class EndpointTest extends \PHPUnit\Framework\TestCase
{

use ReflectionMethods;
Expand Down
2 changes: 1 addition & 1 deletion tests/HumanApi/HumanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class HumanTest
* @package Choccybiccy\HumanApi
*/
class HumanTest extends \PHPUnit_Framework_TestCase
class HumanTest extends \PHPUnit\Framework\TestCase
{

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/HumanApi/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class ModelTest
* @package Choccybiccy\HumanApi
*/
class ModelTest extends \PHPUnit_Framework_TestCase
class ModelTest extends \PHPUnit\Framework\TestCase
{

/**
Expand Down

0 comments on commit 30e862e

Please sign in to comment.