Skip to content

Commit

Permalink
Merge pull request #445 from stevegrunwell/fix/drop-older-php-versions
Browse files Browse the repository at this point in the history
Update the documentation and testing matrix for current PHP releases
  • Loading branch information
bhelx committed Dec 31, 2019
2 parents 8175b45 + ce61510 commit f2bc6ef
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ composer.lock
vendor
composer.phar
.idea
.phpunit.result.cache
32 changes: 20 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
language: php

php:
- 7.4
- 7.3
- 7.2
- 7.1
- 7.0
- 5.6
- hhvm-4.0.0
- hhvm-3.30
- hhvm-3.27
- hhvm-3.24
sudo: false
dist: trusty
install:
- composer install --dev
script: vendor/phpunit/phpunit/phpunit Tests
- nightly

matrix:
fast_finish: true
allow_failures:
- php: hhvm-4.0.0
- php: hhvm-3.24
- php: 7.0
- php: 5.6
- php: 7.0
- php: 7.1
- php: nightly

install:
- composer install --no-interaction --prefer-dist

before_script:
# Remove XDebug for better performance.
- |
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
phpenv config-rm xdebug.ini
fi
script:
- ./vendor/bin/phpunit Tests
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ be careful when upgrading.

### cURL and OpenSSL

The PHP library depends on PHP 5.6 (or higher) and libcurl compiled with
The PHP library depends on PHP 5.6 (or higher, though only PHP 7.2 or newer is officially supported) and libcurl compiled with
OpenSSL support. Open up a `phpinfo();` page and verify that under the curl
section, there's a line that says something like:

Expand Down Expand Up @@ -117,7 +117,6 @@ $ vendor/bin/phpunit
## Supported Versions

We support all ["currently supported versions" of PHP](http://php.net/supported-versions.php).
We also support the LTS versions of [HHVM](https://docs.hhvm.com/hhvm/installation/release-schedule), but only those which support PHP and Composer.

## Contributing Guidelines

Expand Down
18 changes: 18 additions & 0 deletions Tests/Compat/TestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Placeholders to aid with PHPUnit 6+ compatibility in the test suite.
*
* PHPUnit 6 introduced namespaces, moving the base test class from PHPUnit_Framework_TestCase to
* PHPUnit\Framework\TestCase.
*
* @link https://phpunit.de/announcements/phpunit-6.html
*/

namespace PHPUnit\Framework;

use PHPUnit_Framework_TestCase;

class TestCase extends PHPUnit_Framework_TestCase
{

}
6 changes: 3 additions & 3 deletions Tests/Recurly/Base_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public function testCheckIfResponseContainGetHeadersFunction() {
$this->client->addResponse('GET', 'accounts', 'accounts/index-200.xml');
$accounts = Recurly_Base::_get('accounts', $this->client);
$this->assertTrue(method_exists($accounts, 'getHeaders'),"Accounts Class does not have method getHeaders");
$this->assertInternalType('array',$accounts->getHeaders());
$this->assertInternalType('array', $accounts->getHeaders());

$this->client->addResponse('GET', 'subscriptions', 'subscriptions/index-200.xml');
$subscriptions = Recurly_Base::_get('subscriptions', $this->client);
$this->assertTrue(method_exists($subscriptions, 'getHeaders'),'Subscriptions Class does not have method getHeaders');
$this->assertInternalType('array',$subscriptions->getHeaders());
$this->assertInternalType('array', $subscriptions->getHeaders());

$this->client->addResponse('GET', 'abcdef1234567890', 'adjustments/show-200.xml');
$adjustment = Recurly_Base::_get('abcdef1234567890', $this->client);
$this->assertTrue(method_exists($adjustment, 'getHeaders'),'Adjustments Class does not have method getHeaders');
$this->assertInternalType('array',$adjustment->getHeaders());
$this->assertInternalType('array', $adjustment->getHeaders());
}
}
2 changes: 1 addition & 1 deletion Tests/Recurly/Coupon_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testRedeemCouponExpired() {
$coupon = Recurly_Coupon::get('expired', $this->client);
$this->assertEquals('expired', $coupon->state);

$this->setExpectedException('Recurly_Error', 'Coupon is not redeemable');
$this->expectException('Recurly_Error', 'Coupon is not redeemable');
$redemption = $coupon->redeemCoupon('abcdef1234567890', 'USD');
}

Expand Down
11 changes: 10 additions & 1 deletion Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<?php

use PHPUnit\Framework\TestCase;

require_once dirname(__DIR__) . '/vendor/autoload.php';

// Load compatibility layers for PHP < 7.x.
if (! class_exists(TestCase::class)) {
require_once __DIR__ . '/Compat/TestCase.php';
}

/**
* Base class for our tests that sets up a mock client.
*
* @property Recurly_MockClient $client
*/
abstract class Recurly_TestCase extends PHPUnit_Framework_TestCase {
abstract class Recurly_TestCase extends TestCase {
function setUp() {
$this->client = new Recurly_MockClient();
foreach ($this->defaultResponses() as $request) {
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"license": "MIT",
"authors": [],
"require": {
"php": ">= 5.6.0",
"php": ">=5.6",
"ext-curl": "*"
},
"require-dev": {
"phpunit/phpunit": "4.2.*"
"phpunit/phpunit": ">=5.7,<8"
},
"autoload": {
"classmap": ["lib"]
Expand Down

0 comments on commit f2bc6ef

Please sign in to comment.