Skip to content

Commit

Permalink
Handle Panther driver for Sylius 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometee committed Sep 26, 2024
1 parent 1f2e2ec commit 41efc97
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Feature: Adding a new Stripe Checkout Session payment method

Background:
Given the store operates on a single channel in "United States"
And I am logged in as an administrator

@ui @javascript
Scenario: Adding a new stripe payment method using authorize
Given I am logged in as an administrator
And I want to create a new Stripe Checkout Session payment method
Given I want to create a new Stripe Checkout Session payment method
When I name it "Stripe Checkout Session" in "English (United States)"
And I specify its code as "stripe_sca_test"
And I configure it with test stripe gateway data "TEST", "TEST"
Expand All @@ -23,8 +23,7 @@ Feature: Adding a new Stripe Checkout Session payment method

@ui @javascript
Scenario: Adding a new stripe payment method not using authorize
Given I am logged in as an administrator
And I want to create a new Stripe Checkout Session payment method
Given I want to create a new Stripe Checkout Session payment method
When I name it "Stripe Checkout Session" in "English (United States)"
And I specify its code as "stripe_sca_test"
And I configure it with test stripe gateway data "TEST", "TEST"
Expand Down
7 changes: 3 additions & 4 deletions features/admin/stripe_js/managing_payment_method.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Feature: Adding a new Stripe JS payment method

Background:
Given the store operates on a single channel in "United States"
And I am logged in as an administrator

@ui @javascript
Scenario: Adding a new stripe payment method using authorize
Given I am logged in as an administrator
And I want to create a new Stripe JS payment method
Given I want to create a new Stripe JS payment method
When I name it "Stripe JS" in "English (United States)"
And I specify its code as "stripe_sca_test"
And I configure it with test stripe gateway data "TEST", "TEST"
Expand All @@ -23,8 +23,7 @@ Feature: Adding a new Stripe JS payment method

@ui @javascript
Scenario: Adding a new stripe payment method not using authorize
Given I am logged in as an administrator
And I want to create a new Stripe JS payment method
Given I want to create a new Stripe JS payment method
When I name it "Stripe JS" in "English (United States)"
And I specify its code as "stripe_sca_test"
And I configure it with test stripe gateway data "TEST", "TEST"
Expand Down
31 changes: 31 additions & 0 deletions tests/Behat/Bug/PantherCookieSetter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace Tests\FluxSE\SyliusPayumStripePlugin\Behat\Bug;

use Behat\Mink\Driver\PantherDriver;
use Behat\Mink\Session;
use Sylius\Behat\Service\Setter\CookieSetterInterface;

final class PantherCookieSetter implements CookieSetterInterface
{
public function __construct(
private Session $minkSession,
private CookieSetterInterface $decoratedCookieSetter
) {
}

public function setCookie($name, $value): void
{
$driver = $this->minkSession->getDriver();

if ($driver instanceof PantherDriver) {
if (!$driver->isStarted()) {
$driver->start();
}
}

$this->decoratedCookieSetter->setCookie($name, $value);
}
}
1 change: 1 addition & 0 deletions tests/Behat/Resources/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<imports>
<import resource="services/bug.xml"/>
<import resource="services/context.xml"/>
<import resource="services/payum_mocks.xml"/>
<import resource="services/mocker.xml"/>
Expand Down
10 changes: 10 additions & 0 deletions tests/Behat/Resources/services/bug.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>

<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="Tests\FluxSE\SyliusPayumStripePlugin\Behat\Bug\PantherCookieSetter" decorates="sylius.behat.cookie_setter">
<argument type="service" id="behat.mink.default_session" />
<argument type="service" id="Tests\FluxSE\SyliusPayumStripePlugin\Behat\Bug\PantherCookieSetter.inner" />
</service>
</services>
</container>

0 comments on commit 41efc97

Please sign in to comment.