PHP 8.x support (#727)

* Set dependencies for 7.3 and 8.x

* Set GitHub Actions for PHP 7.3, 7.4 and 8.0

* Set Ubuntu version that supports PHP from 7.1 to 7.4

According to warnings raised by GitHub Actions, the alias for the latest
Ubuntu version will upgrade soon to the newer 20.04 LTS instead of 18.04.

Aiming to ensure the compatibility with previous PHP versions, it's safer
to force the Ubuntu 18.04 that has the previous PHP version as built-in
versions in the OS

https://github.com/marketplace/actions/setup-php-action#github-hosted-runners

* Fix dependencies for PHP ^7.3 and ^8.0 support

* Run test suite with PHP versions from 7.3 to 8.1

* Broken Prophecy dependency for PHPUnit on PHP 8.1

This broken dependency doesn't allow us to run PHPUnit tests and ensure it works. Keeping the ^8.0 version should allow installations for non-maintainers on newer versions too.

https://packagist.org/packages/phpspec/prophecy#1.12.2

requires
- php: ^7.2 || ~8.0, <8.1
- ...

* Use the latest Ubuntu version instead of a specific version

* Prepare Changelog for PHP 8.0
This commit is contained in:
David Garcia 2021-01-30 06:39:30 +00:00 committed by GitHub
parent a084abdb86
commit 66fd858a02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 33 additions and 21 deletions

View File

@ -11,8 +11,9 @@ jobs:
strategy:
matrix:
# https://github.com/marketplace/actions/setup-php-action#github-hosted-runners
operating-system: [ 'ubuntu-latest' ]
php-versions: [ '7.1', '7.2', '7.3', '7.4' ]
php-versions: [ '7.3', '7.4', '8.0' ]
runs-on: ${{ matrix.operating-system }}
@ -37,13 +38,13 @@ jobs:
run: composer test
- name: PHP Stan
if: matrix.php-versions == '7.1'
if: matrix.php-versions == '7.3'
run: |
phpstan --version
phpstan analyse
- name: Scrunitizer CI
if: matrix.php-versions == '7.1'
if: matrix.php-versions == '7.3'
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ composer.lock
phpunit.phar
phpunit.xml
modd.conf
.phpunit.result.cache

View File

@ -2,6 +2,16 @@
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
## [Unreleased]
### Added
- Support for PHP 8.x
### Removed
- Support for PHP 7.1 and 7.2 as they both have reached their end of life
## 3.2.0
### Added

View File

@ -2,18 +2,18 @@
"name": "mailgun/mailgun-php",
"description": "The Mailgun SDK provides methods for all API functions.",
"require": {
"php": "^7.1",
"psr/http-client": "^1.0",
"php-http/multipart-stream-builder": "^1.0",
"php-http/client-common": "^1.9 || ^2.0",
"php-http/discovery": "^1.6",
"webmozart/assert": "^1.6"
"php": "^7.3 || ^8.0",
"psr/http-client": "^1.0.1",
"php-http/multipart-stream-builder": "^1.1.2",
"php-http/client-common": "^2.2.1",
"php-http/discovery": "^1.9.1",
"webmozart/assert": "^1.9.1"
},
"require-dev": {
"phpunit/phpunit": "^7.5",
"php-http/guzzle6-adapter": "^1.0 || ^2.0",
"nyholm/psr7": "^1.0",
"nyholm/nsa": "^1.1"
"phpunit/phpunit": "^9.3",
"php-http/guzzle7-adapter": "^0.1.1",
"nyholm/psr7": "^1.3.1",
"nyholm/nsa": "^1.2.1"
},
"autoload": {
"psr-4": {

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Mailgun\Tests\Api;
use GuzzleHttp\Psr7\Response;
use Mailgun\Exception\InvalidArgumentException;
use Mailgun\Hydrator\ModelHydrator;
use Mailgun\Model\Stats\TotalResponse;
use Mailgun\Model\Stats\TotalResponseItem;
@ -44,11 +45,10 @@ class StatsTest extends TestCase
$this->assertContainsOnlyInstancesOf(TotalResponseItem::class, $total->getStats());
}
/**
* @expectedException \Mailgun\Exception\InvalidArgumentException
*/
public function testTotalInvalidArgument()
{
$this->expectException(InvalidArgumentException::class);
$api = $this->getApiMock();
$api->total('');
}

View File

@ -37,7 +37,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
private $hydrateClass;
protected function setUp()
protected function setUp(): void
{
$this->reset();
}

View File

@ -40,7 +40,7 @@ class RequestBuilderTest extends MailgunTestCase
/**
* Environment preset.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -61,7 +61,7 @@ class RequestBuilderTest extends MailgunTestCase
/**
* Environment reset.
*/
protected function tearDown()
protected function tearDown(): void
{
parent::tearDown();

View File

@ -25,7 +25,7 @@ class BatchMessageTest extends MailgunTestCase
*/
private $batchMessage;
public function setUp()
public function setUp(): void
{
$messageApi = $this->getMockBuilder(Message::class)
->disableOriginalConstructor()

View File

@ -22,7 +22,7 @@ class MessageBuilderTest extends MailgunTestCase
*/
private $messageBuilder;
public function setUp()
public function setUp(): void
{
$this->messageBuilder = new MessageBuilder();
}