Skip to content

Commit

Permalink
Merge pull request #8 from ahaskioglu-valiton/update-to-php-81
Browse files Browse the repository at this point in the history
PHP 8.1
  • Loading branch information
nymo authored Jun 20, 2024
2 parents 79162eb + 1756497 commit 2319949
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 118 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ name: CI
on: [push, pull_request]

jobs:
build-test-71:
build-test-74:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: php-actions/composer@v6
with:
version: 1
php_version: "7.1"
version: 2
php_version: "7.4"

- name: PHPUnit Tests
uses: php-actions/phpunit@v3
with:
version: 7
php_version: "7.1"
version: 9
php_version: "7.4"
configuration: phpunit.xml.dist
bootstrap: vendor/autoload.php
build-test-74:

build-test-81:
runs-on: ubuntu-latest

steps:
Expand All @@ -30,12 +31,12 @@ jobs:
- uses: php-actions/composer@v6
with:
version: 2
php_version: "7.4"
php_version: "8.1"

- name: PHPUnit Tests
uses: php-actions/phpunit@v3
with:
version: 7
php_version: "7.4"
version: 9
php_version: "8.1"
configuration: phpunit.xml.dist
bootstrap: vendor/autoload.php
16 changes: 0 additions & 16 deletions .gitlab-ci.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Action/Api/ConvertGiropayErrorsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function execute($request)
$response = $request->getResponse();

if (Api::STATUS_ERROR != $response[Api::FIELD_STATUS]
|| !array_key_exists(Api::FIELD_PAYMENT_METHOD, $model)
|| !$model[Api::FIELD_PAYMENT_METHOD]
|| $model[Api::FIELD_PAYMENT_METHOD] != Api::PAYMENT_METHOD_GIROPAY
) {
return;
Expand Down
3 changes: 0 additions & 3 deletions Tests/Action/Api/GetSepaMandatePdfActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

namespace Valiton\Payum\Payone\Tests\Action\Api;

use GuzzleHttp\Client;
use Payum\Core\Bridge\Guzzle\HttpClient;
use Valiton\Payum\Payone\Action\Api\GetSepaMandatePdfAction;
use Valiton\Payum\Payone\Api;
use Valiton\Payum\Payone\Request\Api\GetSepaMandatePdf;
use Valiton\Payum\Payone\Tests\Action\AbstractActionTest;

Expand Down
9 changes: 4 additions & 5 deletions Tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
use Payum\Core\Bridge\Guzzle\HttpClient;
use Payum\Core\HttpClientInterface;
use Payum\Core\Tests\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Valiton\Payum\Payone\Api;

class ApiTest extends TestCase
Expand Down Expand Up @@ -96,7 +95,7 @@ public function testDecodeBodyHandlesNewlineInMandateText()
Api::FIELD_LAST_NAME => 'Mustermann',
]);

$this->assertInternalType('array', $response);
$this->assertIsArray($response);
$this->assertArrayHasKey(Api::FIELD_MANDATE_TEXT, $response);
$this->assertStringStartsWith('<div class="mandatetext">', $response[Api::FIELD_MANDATE_TEXT]);
$this->assertStringEndsWith('</div>', $response[Api::FIELD_MANDATE_TEXT]);
Expand Down Expand Up @@ -204,15 +203,15 @@ protected function createHttpClient()
}

/**
* @return \PHPUnit_Framework_MockObject_MockObject|HttpClientInterface
* @return MockObject|HttpClientInterface
*/
protected function createHttpClientMock()
{
return $this->createMock(HttpClientInterface::class);
}

/**
* @return \PHPUnit_Framework_MockObject_MockObject|HttpClientInterface
* @return MockObject|HttpClientInterface
*/
protected function createSuccessHttpClientStub($responseBody = '')
{
Expand Down
28 changes: 0 additions & 28 deletions Tests/PayoneGatewayFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,6 @@ public function couldBeConstructedWithoutAnyArguments()
new PayoneGatewayFactory();
}

/**
* @test
*/
public function shouldCreateCoreGatewayFactoryIfNotPassed()
{
$factory = new PayoneGatewayFactory();

$this->assertAttributeInstanceOf(CoreGatewayFactory::class, 'coreGatewayFactory', $factory);
}

/**
* @test
*/
public function shouldUseCoreGatewayFactoryPassedAsSecondArgument()
{
$coreGatewayFactory = $this->createMock(GatewayFactoryInterface::class);

$factory = new PayoneGatewayFactory(array(), $coreGatewayFactory);

$this->assertAttributeSame($coreGatewayFactory, 'coreGatewayFactory', $factory);
}

/**
* @test
*/
Expand All @@ -66,12 +44,6 @@ public function shouldAllowCreateGateway()
]);

$this->assertInstanceOf('Payum\Core\Gateway', $gateway);

$this->assertAttributeNotEmpty('apis', $gateway);
$this->assertAttributeNotEmpty('actions', $gateway);

$extensions = $this->readAttribute($gateway, 'extensions');
$this->assertAttributeNotEmpty('extensions', $extensions);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
}
],
"require": {
"php": ">=7.1.3",
"php": ">=7.3 | ^8.1",
"payum/core": "^1.7",
"psr/log": "^1.0",
"php-http/guzzle7-adapter": "^1.0"
"php-http/guzzle7-adapter": "^1.0",
"php-http/message-factory": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
Expand Down
43 changes: 15 additions & 28 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="Tests/bootstrap.php"
>
<testsuites>
<testsuite name="Payum Extension Test Suite for PAYONE">
<directory>./Tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory>./</directory>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="Tests/bootstrap.php">
<coverage processUncoveredFiles="true">
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Payum Extension Test Suite for PAYONE">
<directory>./Tests</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 2319949

Please sign in to comment.