Skip to content

Commit

Permalink
Merge pull request #66 from FLUX-SE/fix-php7.4
Browse files Browse the repository at this point in the history
Fix php7.4
  • Loading branch information
Prometee authored Nov 22, 2024
2 parents 96de315 + 1c39957 commit d4b333e
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 90 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "8.1" ]
php: [ "7.4", "8.1" ]
symfony: [ "^5.4", "^6.4" ]
exclude:
-
php: "7.4"
symfony: "^6.4"

steps:
-
Expand Down
3 changes: 2 additions & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
$config->paths([
'src',
'tests/Behat',
'spec',
'ecs.php',
]);

// PHP 7 compatibility
$config->ruleWithConfiguration(TrailingCommaInMultilineFixer::class, ['elements' => ['arrays']]);

};
20 changes: 10 additions & 10 deletions spec/Extension/CancelExistingPaymentIntentExtensionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public function it_doesnt_found_the_related_session_and_do_nothing(
->willReturn($allSessionRequest);

$allSessionRequest->setParameters([
'payment_intent' => $piId
'payment_intent' => $piId,
])->shouldBeCalled();
$allSessionRequest->getApiResources()->willReturn(Collection::constructFrom(['data'=>[]]));
$allSessionRequest->getApiResources()->willReturn(Collection::constructFrom(['data' => []]));

$gateway->execute($allSessionRequest)->shouldBeCalled();

Expand Down Expand Up @@ -139,15 +139,15 @@ public function it_founds_a_related_expired_session_and_does_nothing(
->willReturn($allSessionRequest);

$allSessionRequest->setParameters([
'payment_intent' => $piId
'payment_intent' => $piId,
])->shouldBeCalled();
$allSessionRequest->getApiResources()->willReturn(Collection::constructFrom([
'data'=>[
'data' => [
[
'id' => $csId,
'status' => Session::STATUS_EXPIRED,
]
]
],
],
]));

$gateway->execute($allSessionRequest)->shouldBeCalled();
Expand Down Expand Up @@ -183,15 +183,15 @@ public function it_founds_a_related_session_and_expires_it(
->willReturn($allSessionRequest);

$allSessionRequest->setParameters([
'payment_intent' => $piId
'payment_intent' => $piId,
])->shouldBeCalled();
$allSessionRequest->getApiResources()->willReturn(Collection::constructFrom([
'data'=>[
'data' => [
[
'id' => $csId,
'status' => Session::STATUS_OPEN,
]
]
],
],
]));

$gateway->execute($allSessionRequest)->shouldBeCalled();
Expand Down
8 changes: 4 additions & 4 deletions spec/StateMachine/CancelOrderProcessorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

use FluxSE\SyliusPayumStripePlugin\Command\CancelPayment;
use PhpSpec\ObjectBehavior;
use SM\Event\TransitionEvent;
use Sylius\Component\Core\Model\PaymentInterface;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\MessageBusInterface;

final class CancelOrderProcessorSpec extends ObjectBehavior
{
public function let(MessageBusInterface $commandBus): void {
public function let(MessageBusInterface $commandBus): void
{
$this->beConstructedWith($commandBus);
}

public function it_is_invokable_when_it_is_new(
PaymentInterface $payment,
MessageBusInterface $commandBus,
MessageBusInterface $commandBus
): void {
$payment->getId()->willReturn(1);

Expand Down Expand Up @@ -48,7 +48,7 @@ public function it_do_nothing_when_it_is_completed(
}

public function it_do_nothing_when_it_is_refunded(
PaymentInterface $payment,
PaymentInterface $payment
): void {
$this->__invoke($payment, PaymentInterface::STATE_REFUNDED);
}
Expand Down
4 changes: 2 additions & 2 deletions spec/StateMachine/CaptureAuthorizedOrderProcessorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

use FluxSE\SyliusPayumStripePlugin\Command\CaptureAuthorizedPayment;
use PhpSpec\ObjectBehavior;
use SM\Event\TransitionEvent;
use Sylius\Component\Core\Model\PaymentInterface;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\MessageBusInterface;

final class CaptureAuthorizedOrderProcessorSpec extends ObjectBehavior
{
public function let(MessageBusInterface $commandBus): void {
public function let(MessageBusInterface $commandBus): void
{
$this->beConstructedWith($commandBus);
}

Expand Down
5 changes: 2 additions & 3 deletions spec/StateMachine/RefundOrderProcessorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

use FluxSE\SyliusPayumStripePlugin\Command\RefundPayment;
use PhpSpec\ObjectBehavior;
use SM\Event\TransitionEvent;
use Sylius\Component\Core\Model\PaymentInterface;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\MessageBusInterface;

final class RefundOrderProcessorSpec extends ObjectBehavior
{
public function let(MessageBusInterface $commandBus): void {
public function let(MessageBusInterface $commandBus): void
{
$this->beConstructedWith($commandBus, false);
}

Expand All @@ -33,7 +33,6 @@ public function it_do_nothing_when_it_is_disabled(
PaymentInterface $payment,
MessageBusInterface $commandBus
): void {

$this->beConstructedWith($commandBus, true);

$command = new RefundPayment(1);
Expand Down
15 changes: 12 additions & 3 deletions src/Extension/UpdatePaymentStateExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@ final class UpdatePaymentStateExtension implements ExtensionInterface
/** @var PaymentInterface[] */
private array $scheduledPaymentsToProcess = [];

private StateMachineInterface $stateMachine;

private StorageInterface $storage;

private GetStatusFactoryInterface $getStatusRequestFactory;

public function __construct(
private StateMachineInterface $stateMachine,
private StorageInterface $storage,
private GetStatusFactoryInterface $getStatusRequestFactory
StateMachineInterface $stateMachine,
StorageInterface $storage,
GetStatusFactoryInterface $getStatusRequestFactory
) {
$this->getStatusRequestFactory = $getStatusRequestFactory;
$this->storage = $storage;
$this->stateMachine = $stateMachine;
}

public function onPreExecute(Context $context): void
Expand Down
81 changes: 30 additions & 51 deletions tests/Application/config/jwt/private-test.pem
Original file line number Diff line number Diff line change
@@ -1,51 +1,30 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKAIBAAKCAgEAxuS1SudSNkjTQcP4H5SjzrdO29upko9KYZgUH6z5n+weDtIo
5tysdm7xY3nNAU9ixo7wrBvttuf7T1fDCVJjhzqX5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0QZ1vTRGMly+6Rcm1vD0Qa9Mfuo9oNmqvCGwWFwieCxypHGZe89kMcMT
K3dk4NjeZ54XNNmPFuY1W2WHv54ZG0uTGJZOan83u3DJyKUL3qN/6liTnLjePYXi
rSFHkB0IzuwDXsVwtw3d+LrMWfL1mrFCJ0XOCswNO/7usyXnlUqPKuy+DXpttDoI
xFu7pGpnIl7vXUzcvj1PWYA73PZsgEAThM3P2xiWOA8Mpa6GV2CoXVf/YeVtRoON
Z+zNd+ftvw3ERZz6WrTuBa0flyqhqmC54Jfetz9fQNg9lty9iOUgnJOwzIX6AqCU
G+BaiyhCRacCFvoTL1GgdiQxDFYeDOKMgdwNsnRn+fw7/BsuIY8Fdhtu928Bi/Zr
98XzvKPt++hYc2SBwv4H+90GgFyI/5lDHkeU+O/isg8wXrF8Ql53GLJK57CAE9R7
NsKGJiKL1iH7qBVTHkRDsdX0m7rgXTgip1MUbbwOFtdmYDZ25OY1sVI2O4AWoXyE
tI1IQIEZid727HWef6zPkOVEE57NWtbH+Mu89NjOMDu2O+aLGt/AMrD/dKgUWTCs
+y78NWkWI+RJDx3KGzLRQfqVEt5WIf+D
-----END ENCRYPTED PRIVATE KEY-----
21 changes: 8 additions & 13 deletions tests/Application/config/jwt/public-test.pem
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxuS1SudSNkjTQcP4H5Sj
zrdO29upko9KYZgUH6z5n+weDtIo5tysdm7xY3nNAU9ixo7wrBvttuf7T1fDCVJj
hzqX5iewaCZks7q9kYygCbvmrAocbx5D9EPZPH0sQQoa9gMuNou2nqWpVdTYCMAj
xzVpqa2krioUzkBJzaWGDYiijv9qKbjWvRUUoYFNOFIFXHFFDrK5ISBC155XiETK
yBYhB1wZVWX1tHe1nDW609BHAAsr1Ve3uiodzYzQ7S9Rw9Q6RCRSRgZRzFV1GTJE
uyMpCCD51DA4otYeEPQf+8hvV3aKbSNydzrQICY95kfB0p9HxorBPh8QHq0qKZOI
le1Aglp0UV3OWgXLWncNc0m8e8hT2I55lYkLio99/4PGfalAdJBPhKtTzbJllaER
HOnlMkEvwk7eggkbbXEN/Ay6usi0R8mRaxhMkS9i8MxubgQBDsOomtegRqA1EzSG
U/FJMS5g/I/gO9bjFu2l2LJwd6B4t/FZt/9mAIGYbIj5/Ykd0E1WIKYAIRUoyW1g
TrGe70yxdHEPEILnZZMRVJzDbkVYfgKAFUpAUqbHTtS+YI6p9tjFuxBrc6GZR/kp
pL/MkEARDX0ZX3n4sPLQf/vdR7+Ks8Yqws1IqsZ3h8iP8WpykbEwnd1w49A1ZBBi
nIXU3idf41EtQgawbpK5Oy0CAwEAAQ==
-----END PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn3qaayYIb004HknI2wAx
rX5mbhb5KerstzhpD60untZJg1rM+JFndeDI1pfxpyH6PT2J6ZroxjmRRfAe/dy9
igLqk74t4euqGdl3uXPH+n/B88T5B/2RBmB6DHrZ0AVXh7MQeJRGgOrSB66VrLeT
O/mrTQxc85BYft+u5Hv7LE6kygGyv1I+e2/mtXHKsrinAmHu3H5mI4t1PuJCEwPw
e/z/Cd7Sge0hNwjw33Xm8hrsk2J6JX16lv8SWKIlUGrDNMDNRk+KZHhQaSyRjkxw
5OYzvPpMPxNFNKF2X2+RCIkoMXUfqesBqTbv9kDBoEQJgkBkPbi3Os2ozpMuXsI7
GQIDAQAB
-----END PUBLIC KEY-----
10 changes: 8 additions & 2 deletions tests/Behat/Bug/PantherCookieSetter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@

final class PantherCookieSetter implements CookieSetterInterface
{
private Session $minkSession;

private CookieSetterInterface $decoratedCookieSetter;

public function __construct(
private Session $minkSession,
private CookieSetterInterface $decoratedCookieSetter
Session $minkSession,
CookieSetterInterface $decoratedCookieSetter
) {
$this->decoratedCookieSetter = $decoratedCookieSetter;
$this->minkSession = $minkSession;
}

public function setCookie($name, $value): void
Expand Down

0 comments on commit d4b333e

Please sign in to comment.