diff --git a/.gitignore b/.gitignore index 3be9b54..7b4c47c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ build vendor composer.lock phpunit.xml +.phpunit.result.cache .DS_Store diff --git a/.travis.yml b/.travis.yml index f52bc7f..4892e0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,9 +12,6 @@ env: global: - COVERAGE=0 matrix: - - LARAVEL='5.5.*' TESTBENCH='3.5.*' - - LARAVEL='5.6.*' TESTBENCH='3.6.*' - - LARAVEL='5.7.*' TESTBENCH='3.7.*' - LARAVEL='5.8.*' TESTBENCH='3.8.*' - LARAVEL='6.*' TESTBENCH='4.*' diff --git a/composer.json b/composer.json index 4816204..cd02fee 100644 --- a/composer.json +++ b/composer.json @@ -41,14 +41,15 @@ "socialite" ], "require": { - "php": ">=7.0.0", - "illuminate/support": "^5.5|^6.0", - "mollie/mollie-api-php": "^2.9" + "php": "^7.1.3|^7.2", + "illuminate/support": "^5.8.0|^6.0", + "mollie/mollie-api-php": "^2.9", + "ext-json": "*" }, "require-dev": { - "graham-campbell/testbench": "^4.0|^5.0", + "graham-campbell/testbench": "^5.0|^6.0", "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.0|^7.0|^8.3", + "phpunit/phpunit": "^7.5|^8.0", "laravel/socialite": "^3.0|^4.0" }, "suggest": { diff --git a/src/MollieConnectProvider.php b/src/MollieConnectProvider.php index dd44d30..0c14794 100644 --- a/src/MollieConnectProvider.php +++ b/src/MollieConnectProvider.php @@ -31,6 +31,7 @@ */ namespace Mollie\Laravel; +use Illuminate\Support\Arr; use Laravel\Socialite\Two\AbstractProvider; use Laravel\Socialite\Two\ProviderInterface; use Laravel\Socialite\Two\User; @@ -148,7 +149,7 @@ protected function getRefreshTokenFields($refresh_token) */ public function getTokenFields($code) { - return array_add(parent::getTokenFields($code), 'grant_type', 'authorization_code'); + return Arr::add(parent::getTokenFields($code), 'grant_type', 'authorization_code'); } /** diff --git a/tests/MollieConnectProviderTest.php b/tests/MollieConnectProviderTest.php index e76df5d..aefb131 100644 --- a/tests/MollieConnectProviderTest.php +++ b/tests/MollieConnectProviderTest.php @@ -54,4 +54,20 @@ public function testExceptionIsThrownIfStateIsNotSet() $provider = new MollieConnectProvider($request, 'client_id', 'client_secret', 'redirect'); $user = $provider->user(); } + + public function testGetTokenFields() + { + $request = Request::create('foo'); + $provider = new MollieConnectProvider($request, 'client_id', 'client_secret', 'redirect'); + $this->assertEquals( + [ + 'client_id' => 'client_id', + 'client_secret' => 'client_secret', + 'code' => 'dummy_code', + 'redirect_uri' => 'redirect', + 'grant_type' => 'authorization_code', + ], + $provider->getTokenFields('dummy_code') + ); + } }