diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8135d55 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: Basic-CI + +on: [push, pull_request] + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + operating-system: [ubuntu-latest] + php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2'] + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + + - name: Install dependencies + run: | + composer install --no-interaction --no-progress --optimize-autoloader + + - name: run Tests + run: | + php $GITHUB_WORKSPACE/vendor/bin/phpunit --configuration $GITHUB_WORKSPACE/phpunit.xml.dist --colors=never diff --git a/.gitignore b/.gitignore index e6e5bb7..f7fb9c1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ composer.lock vendor composer.phar .idea +/.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9d28361..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: php - -php: -# - 5.6 -# - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -## Cache composer -cache: - directories: - - $HOME/.composer/cache - -install: - - composer install -n --dev --prefer-source - -script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text diff --git a/README.md b/README.md index d103996..8c44184 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Developer Docs: http://www.polipaymentdeveloper.com/ [![Total Downloads](https://poser.pugx.org/burnbright/omnipay-poli/d/total.png)](https://packagist.org/packages/burnbright/omnipay-poli) [Omnipay](https://github.com/omnipay/omnipay) is a framework agnostic, multi-gateway payment -processing library for PHP 5.3+. This package implements Poli support for Omnipay. +processing library for PHP 7.2+. This package implements Poli support for Omnipay. ## Installation @@ -20,7 +20,7 @@ to your `composer.json` file: ```json { "require": { - "burnbright/omnipay-poli": "~2.0" + "burnbright/omnipay-poli": "~3.0" } } ``` diff --git a/composer.json b/composer.json index 2040ced..c278aed 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,11 @@ "name": "Sid Bachtiar", "email": "sid.bachtiar@gmail.com", "homepage": "http://onlinesid.com" + }, + { + "name": "Toby Evans", + "email": "tobz.nz@gmail.com", + "homepage": "https://tobz.nz" } ], "autoload": { @@ -30,15 +35,22 @@ } }, "require": { - "php": ">=7.1", - "omnipay/common": "^3.0" + "php": ">=7.3", + "omnipay/common": "^3.2", + "symfony/http-client": "^5.4" }, "require-dev": { - "mockery/mockery": "^1.3", - "squizlabs/php_codesniffer": "^3.5", - "phpunit/phpunit": "~6", - "omnipay/tests": "^3.1" + "phpunit/phpunit": "^9.6", + "mockery/mockery": "^1.5", + "squizlabs/php_codesniffer": "^3.7", + "omnipay/tests": "^4.1", + "http-interop/http-factory-guzzle": "^1.2" }, "extra": { + }, + "config": { + "allow-plugins": { + "php-http/discovery": true + } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a61160c..7dbb39a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,25 +1,21 @@ + backupStaticAttributes="false" + bootstrap="tests/bootstrap.php" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + processIsolation="false" + stopOnFailure="false"> ./tests/ - + - - - ./src - - diff --git a/tests/GatewayTest.php b/tests/GatewayTest.php index 8fa636e..5a785fc 100644 --- a/tests/GatewayTest.php +++ b/tests/GatewayTest.php @@ -7,8 +7,7 @@ class GatewayTest extends GatewayTestCase { - - public function setUp() + public function setUp(): void { parent::setUp(); $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest()); @@ -17,7 +16,7 @@ public function setUp() $this->gateway->setAuthenticationCode('a;sldkfjasdf;aladjs'); } - public function testproductionMode() + public function testproductionMode(): void { $this->assertEquals( "https://poliapi.apac.paywithpoli.com/api/v2/Transaction/Initiate", @@ -40,17 +39,17 @@ public function testTestMode() $this->gateway->setTestMode(true); $this->assertEquals( - "https://poliapi.uat1.paywithpoli.com/api/v2/Transaction/Initiate", + "https://poliapi.uat3.paywithpoli.com/api/v2/Transaction/Initiate", $this->gateway->purchase()->getEndpoint() ); $this->assertEquals( - "https://poliapi.uat1.paywithpoli.com/api/v2/Transaction/GetTransaction", + "https://poliapi.uat3.paywithpoli.com/api/v2/Transaction/GetTransaction", $this->gateway->fetchCheckout()->getEndpoint() ); $this->assertEquals( - "https://poliapi.uat1.paywithpoli.com/api/v2/Transaction/GetTransaction", + "https://poliapi.uat3.paywithpoli.com/api/v2/Transaction/GetTransaction", $this->gateway->completePurchase()->getEndpoint() ); } diff --git a/tests/Message/PurchaseRequestTest.php b/tests/Message/PurchaseRequestTest.php index b1c32cc..a580b16 100644 --- a/tests/Message/PurchaseRequestTest.php +++ b/tests/Message/PurchaseRequestTest.php @@ -7,8 +7,9 @@ class PurchaseRequestTest extends TestCase { + protected $request; - public function setUp() + public function setUp(): void { $this->request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); }