Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PHPUnit to 9.5 #241

Merged
merged 14 commits into from
Jul 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/tests export-ignore
/docs export-ignore
/.travis.yml export-ignore
/.scrutinizer.yml export-ignore
/phpunit.xml export-ignore
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
composer_require_extra:
php-http/discovery:^1.18.1
squizlabs/php_codesniffer:^3.7.2
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
* Please squash each branch you create into a single commit. This keeps things tidy.
* Ensure your code is nicely formatted according to the SilverStripe [coding conventions](http://doc.silverstripe.org/framework/en/trunk/misc/coding-conventions).
* Send the pull request(s). Generally you can submit against the master branch.
* Check that the Travis CI build passed. If not, rinse and repeat.
* Check that the CI build passed. If not, rinse and repeat.

Have a read of SilverStripe's contributing guidelines if you haven't already: http://doc.silverstripe.org/framework/en/trunk/misc/contributing/code
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SilverStripe Payments via Omnipay

[![Build Status](https://api.travis-ci.org/silverstripe/silverstripe-omnipay.png)](https://travis-ci.org/silverstripe/silverstripe-omnipay)
[![CI](https://github.com/silverstripe/silverstripe-omnipay/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-omnipay/actions/workflows/ci.yml)
[![Code Coverage](https://codecov.io/gh/silverstripe/silverstripe-omnipay/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-omnipay)
[![Latest Stable Version](https://poser.pugx.org/silverstripe/silverstripe-omnipay/v/stable.png)](https://packagist.org/packages/silverstripe/silverstripe-omnipay)
[![Total Downloads](https://poser.pugx.org/silverstripe/silverstripe-omnipay/downloads.png)](https://packagist.org/packages/silverstripe/silverstripe-omnipay)
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
"omnipay/common": "^3"
},
"require-dev": {
"guzzlehttp/psr7": "^2.5",
"silverstripe/versioned" : "^1.0",
"phpunit/phpunit": "^5.7",
"php-http/guzzle6-adapter": "^1.1",
"phpunit/phpunit": "^9.5",
"php-http/guzzle7-adapter": "^1",
"omnipay/paypal": "^3",
"omnipay/dummy": "^3",
"omnipay/paymentexpress": "^3"
"omnipay/paymentexpress": "^3.1.1",
"symfony/http-foundation": "^5.4.25 || ^6.3.1"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 2 additions & 1 deletion lang/da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ da:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Betalinger
SINGULARNAME: Betaling
TitleTemplate: '{Gateway} {Money} %d/%m/%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd/m/Y'
InvalidUrl: 'Ugyldig betalings url.'
InvalidStatus: 'Ugyldig/ikke håndteret betalingsstatus'
NotFound: 'Betalingen kunne ikke findes.'
Expand Down
3 changes: 2 additions & 1 deletion lang/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ de:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Zahlungen
SINGULARNAME: Zahlung
TitleTemplate: '{Gateway} {Money} %d.%m.%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd.m.Y'
InvalidUrl: 'Ungültige Bezahl-URL'
InvalidStatus: 'Ungültiger Zahlungs-Status'
NotFound: 'Zahlung konnte nicht gefunden werden.'
Expand Down
3 changes: 2 additions & 1 deletion lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ en:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Payments
SINGULARNAME: Payment
TitleTemplate: '{Gateway} {Money} %d/%m/%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd/m/Y'
InvalidUrl: 'Invalid payment url.'
InvalidStatus: 'Invalid/unhandled payment status'
NotFound: 'Payment could not be found.'
Expand Down
3 changes: 2 additions & 1 deletion lang/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ fr:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Paiement
SINGULARNAME: Paiement
TitleTemplate: '{Gateway} {Money} %d.%m.%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd.m.Y'
InvalidUrl: 'Page de paiement non valable.'
NotFound: 'Paiement pas trouvé'
Date: 'Date'
Expand Down
3 changes: 2 additions & 1 deletion lang/hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ hr:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Plaćanja
SINGULARNAME: Plaćanje
TitleTemplate: '{Gateway} {Money} %d/%m/%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd/m/Y'
InvalidUrl: 'Neispravan link plaćanja.'
InvalidStatus: 'Neispravan/nepostojeći status plaćanja'
NotFound: 'Plaćanje nije pronađeno.'
Expand Down
3 changes: 2 additions & 1 deletion lang/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ it:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Pagamenti
SINGULARNAME: Pagamento
TitleTemplate: '{Gateway} {Money} %d/%m/%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd/m/Y'
InvalidUrl: 'Url di pagamento non valida.'
InvalidStatus: 'Status di pagamento non valido/non gestito'
NotFound: 'Pagamento non trovato.'
Expand Down
3 changes: 2 additions & 1 deletion lang/nb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ nb:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Batalinger
SINGULARNAME: Betaling
TitleTemplate: '{Gateway} {Money} %d/%m/%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd/m/Y'
InvalidUrl: 'Ugyldig betalings URL.'
InvalidStatus: 'Invalid/ubehandlet betalingsstatus'
NotFound: 'Betaling kan ikke bli funnet.'
Expand Down
3 changes: 2 additions & 1 deletion lang/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ nl:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Betalingen
SINGULARNAME: Betaling
TitleTemplate: '{Gateway} {Money} %d/%m/%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd/m/Y'
InvalidUrl: 'Ongeldige betalings url.'
InvalidStatus: 'Ongeldige / onverwerkte betaalstatus'
NotFound: 'De betaling kon niet worden gevonden.'
Expand Down
3 changes: 2 additions & 1 deletion lang/nn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ nn:
SilverStripe\Omnipay\Model\Payment:
PLURALNAME: Betalingar
SINGULARNAME: Betaling
TitleTemplate: '{Gateway} {Money} %d/%m/%Y'
TitleTemplate: '{Gateway} {Money} '
TitleTemplateDateFormat: 'd/m/Y'
InvalidUrl: 'Ugyldig betaling URL.'
InvalidStatus: 'Invalid/ubehandla betalingsstatus'
NotFound: 'Betaling kan ikkje bli funne.'
Expand Down
58 changes: 38 additions & 20 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>

<!-- base rules are PSR-2 -->
<rule ref="PSR2" >
<!-- Current exclusions -->
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenercase" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenerdefault" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="Squiz.Scope.MethodScope" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" />
</rule>
<file>src</file>
<file>tests</file>

<!-- PHP-PEG generated file not intended for human consumption -->
<exclude-pattern>*/SSTemplateParser.php$</exclude-pattern>
</ruleset>
<!-- base rules are PSR-2 -->
<rule ref="PSR2" >
<!-- Current exclusions -->
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenercase" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenerdefault" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="Squiz.Scope.MethodScope" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" />
</rule>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1" />
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>

<!-- use short array syntax (less thirdparty) -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax">
<exclude-pattern>/thirdparty/*</exclude-pattern>
</rule>

<!-- include php files only -->
<arg name="extensions" value="php,lib,inc,php5"/>

<!-- PHP-PEG generated file not intended for human consumption -->
<exclude-pattern>*/SSTemplateParser.php$</exclude-pattern>
<exclude-pattern>*/_fakewebroot/*</exclude-pattern>
<exclude-pattern>*/fixtures/*</exclude-pattern>
</ruleset>
24 changes: 13 additions & 11 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Default">
<directory>tests/</directory>
<directory>tests</directory>
</testsuite>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>
</testsuites>
</phpunit>
30 changes: 15 additions & 15 deletions src/Admin/PaymentDevelopmentAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ public function index()
<tbody>';

foreach ($types as $gateway) {
echo '<tr>'.
'<td>'.$gateway->getShortName().'</td>'.
'<td>'.$gateway->getName().'</td>'.
'<td>'.($gateway->supportsPurchase() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsAuthorize() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsCompleteAuthorize() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsCapture() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsCompletePurchase() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsRefund() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsVoid() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsCreateCard() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsDeleteCard() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsUpdateCard() ? 'yes' : '').'</td>'.
'<td>'.($gateway->supportsAcceptNotification() ? 'yes' : '').'</td>'.
echo '<tr>' .
'<td>' . $gateway->getShortName() . '</td>' .
'<td>' . $gateway->getName() . '</td>' .
'<td>' . ($gateway->supportsPurchase() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsAuthorize() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsCompleteAuthorize() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsCapture() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsCompletePurchase() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsRefund() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsVoid() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsCreateCard() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsDeleteCard() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsUpdateCard() ? 'yes' : '') . '</td>' .
'<td>' . ($gateway->supportsAcceptNotification() ? 'yes' : '') . '</td>' .
'</tr>';
if ($this->request->getVar('defaults')) {
echo '<tr><td colspan="13">';
Expand All @@ -84,7 +84,7 @@ private function PaymentTypes()
array_keys(GatewayInfo::getSupportedGateways(false))
));

$supportedGateways = array();
$supportedGateways = [];

array_walk($gateways, function ($name, $index) use (&$supportedGateways, &$factory) {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/Extensions/Payable.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public function TotalPaidOrAuthorized()
public function HasPendingPayments()
{
return $this->owner->Payments()
->filter('Status', array(
->filter('Status', [
'PendingAuthorization',
'PendingPurchase',
'PendingCapture',
'PendingRefund',
'PendingVoid'
))->count() > 0;
])->count() > 0;
}
}
4 changes: 2 additions & 2 deletions src/Extensions/WorldPayResponseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public function updateServiceResponse($response)

$viewer = new SSViewer("WorldPayCallback");

$html = $viewer->process(ArrayData::create(array(
$html = $viewer->process(ArrayData::create([
"ReturnURL" => $return_url
)));
]));

$response->setHttpResponse(new HTTPResponse($html, 200));
}
Expand Down
Loading