From 0bb6aa62f2df1fa409bbabf6baf25a35cfeaee21 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 18 Aug 2021 17:14:44 +0300 Subject: [PATCH 1/5] Allow phpunit 7.x, 8.x for PHP 7.1+ --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c562752b0..f72cfc0a5 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ }, "require-dev": { "woocommerce/woocommerce-sniffs": "^0.1.0", - "phpunit/phpunit": "^9.1", + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", "brain/monkey": "^2.4" }, "autoload": { From 72154085f42efaee8e253dfecec3617f1457daf9 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 18 Aug 2021 17:15:15 +0300 Subject: [PATCH 2/5] No DateTimeInterface::ISO8601 in PHP 7.1 --- tests/PHPUnit/ApiClient/Endpoint/OrderTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/PHPUnit/ApiClient/Endpoint/OrderTest.php b/tests/PHPUnit/ApiClient/Endpoint/OrderTest.php index 4ef8f8f0c..a9dee0af0 100644 --- a/tests/PHPUnit/ApiClient/Endpoint/OrderTest.php +++ b/tests/PHPUnit/ApiClient/Endpoint/OrderTest.php @@ -14,6 +14,7 @@ use Mockery; class OrderTest extends TestCase { + private $dateFormat = 'Y-m-d\TH:i:sO'; // no DateTimeInterface::ISO8601 in 7.1 public function testOrder() { @@ -64,8 +65,8 @@ class OrderTest extends TestCase 'purchase_units' => [ [1], ], - 'create_time' => $createTime->format(\DateTimeInterface::ISO8601), - 'update_time' => $updateTime->format(\DateTimeInterface::ISO8601), + 'create_time' => $createTime->format($this->dateFormat), + 'update_time' => $updateTime->format($this->dateFormat), 'payer' => ['payer'], 'application_context' => ['applicationContext'], 'payment_source' => ['paymentSource'] From 1620029d071db71cdd03f804e36c192c011a54f9 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 18 Aug 2021 17:16:02 +0300 Subject: [PATCH 3/5] Run CI for PHP 7.1-7.4 --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 001d1bdcc..750abe187 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - php-versions: ['7.3'] + php-versions: ['7.1', '7.2', '7.3', '7.4'] steps: - uses: actions/checkout@v2 From 820d2100de77f75b2ec3aaf3923402cd68b70ca4 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 18 Aug 2021 17:37:04 +0300 Subject: [PATCH 4/5] Cache composer deps in ci to make it faster --- .github/workflows/php.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 750abe187..0fe31fad7 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -27,7 +27,9 @@ jobs: run: composer validate - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest + uses: ramsey/composer-install@v1 + with: + composer-options: "--prefer-dist" - name: Run test suite run: ./vendor/bin/phpunit From 125a1f29b99a14752b637f40ebc418f8ab1b00d3 Mon Sep 17 00:00:00 2001 From: Alex Pantechovskis Date: Thu, 19 Aug 2021 10:13:46 +0300 Subject: [PATCH 5/5] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 2a7d414e6..3c68a138f 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ PayPal's latest complete payments processing solution. Accept PayPal, Pay Later, 4. `$ yarn run build:dev` 5. Change the `PAYPAL_INTEGRATION_DATE` constant to `gmdate( 'Y-m-d' )` to run the latest PayPal JavaScript SDK -Note: PHPUnit needs at least PHP 7.3. - ### Unit tests and code style 1. `$ composer install`