Skip to content

Commit

Permalink
Merge pull request #6 from pptasinski/master
Browse files Browse the repository at this point in the history
Update to sylius 1.7
  • Loading branch information
patrick477 authored Aug 13, 2020
2 parents 73c3275 + 3da5e77 commit 0ae9dcc
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 54 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ dist: trusty
sudo: false

php:
- 7.2
- 7.3

cache:
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ $ composer install
$ cd tests/Application
$ yarn install
$ yarn run gulp
$ yarn build
$ bin/console assets:install -e test
$ bin/console doctrine:database:create -e test
$ bin/console doctrine:schema:create -e test
$ bin/console server:run 127.0.0.1:8080 -e test
$ open http://localhost:8080
$ bin/behat
$ bin/phpspec run
$ cd ../..
$ vendor/bin/behat
$ vendor/bin/phpspec run
```

## Contribution
Expand Down
40 changes: 20 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@
"description": "Przelewy24 payment plugin for Sylius applications.",
"license": "MIT",
"require": {
"php": "^7.2",

"sylius/sylius": "^1.6"
"php": "^7.3",
"sylius/sylius": "^1.7"
},
"require-dev": {
"behat/behat": "^3.4",
"behat/mink": "^1.7@dev",
"behat/mink-browserkit-driver": "^1.3",
"behat/mink-extension": "^2.2",
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.3",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.0",
"friends-of-behat/variadic-extension": "^1.1",
"lakion/mink-debug-extension": "^1.2.3",
"phpspec/phpspec": "^5.0",
"phpstan/phpstan-doctrine": "^0.10",
"phpstan/phpstan-shim": "^0.10",
"phpstan/phpstan-symfony": "^0.10",
"phpstan/phpstan-webmozart-assert": "^0.10",
"sensiolabs/security-checker": "^5.0",
"sylius-labs/coding-standard": "^2.0",
"symfony/browser-kit": "^3.4|^4.1",
"symfony/debug-bundle": "^3.4|^4.1",
"symfony/dotenv": "^4.2",
"symfony/intl": "^3.4|^4.1",
"symfony/web-profiler-bundle": "^3.4|^4.1",
"symfony/web-server-bundle": "^3.4|^4.1"
"phpspec/phpspec": "^6.0",
"phpstan/phpstan-doctrine": "^0.12",
"phpstan/phpstan-shim": "^0.12",
"phpstan/phpstan-symfony": "^0.12",
"phpstan/phpstan-webmozart-assert": "^0.12",
"phpunit/phpunit": "^7.0",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^3.0",
"symfony/browser-kit": "^4.4",
"symfony/debug-bundle": "^4.4",
"symfony/intl": "^4.4",
"symfony/web-profiler-bundle": "^4.4",
"symfony/web-server-bundle": "^4.4",
"symfony/dotenv": "^4.4"
},
"conflict": {
"symfony/symfony": "4.1.8",
Expand Down
26 changes: 17 additions & 9 deletions src/Bridge/Przelewy24BridgeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@

interface Przelewy24BridgeInterface
{
const SANDBOX_ENVIRONMENT = 'sandbox';
const PRODUCTION_ENVIRONMENT = 'production';
const SANDBOX_HOST = 'https://sandbox.przelewy24.pl/';
const PRODUCTION_HOST = 'https://secure.przelewy24.pl/';
const P24_API_VERSION = '3.2';
const COMPLETED_STATUS = 'completed';
const FAILED_STATUS = 'failed';
const CANCELLED_STATUS = 'cancelled';
const CREATED_STATUS = 'created';
public const SANDBOX_ENVIRONMENT = 'sandbox';

public const PRODUCTION_ENVIRONMENT = 'production';

public const SANDBOX_HOST = 'https://sandbox.przelewy24.pl/';

public const PRODUCTION_HOST = 'https://secure.przelewy24.pl/';

public const P24_API_VERSION = '3.2';

public const COMPLETED_STATUS = 'completed';

public const FAILED_STATUS = 'failed';

public const CANCELLED_STATUS = 'cancelled';

public const CREATED_STATUS = 'created';

public function getTrnRegisterUrl(): string;

Expand Down
4 changes: 2 additions & 2 deletions tests/Application/Kernel.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ protected function getContainerLoader(ContainerInterface $container): LoaderInte
Assert::isInstanceOf($container, ContainerBuilder::class);

$locator = new FileLocator($this, $this->getRootDir() . '/Resources');
$resolver = new LoaderResolver(array(
$resolver = new LoaderResolver([
new XmlFileLoader($container, $locator),
new YamlFileLoader($container, $locator),
new IniFileLoader($container, $locator),
new PhpFileLoader($container, $locator),
new GlobFileLoader($container, $locator),
new DirectoryLoader($container, $locator),
new ClosureLoader($container),
));
]);

return new DelegatingLoader($resolver);
}
Expand Down
10 changes: 6 additions & 4 deletions tests/Application/config/bootstrap.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<?php

declare(strict_types=1);

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__).'../../../vendor/autoload.php';
require dirname(__DIR__) . '../../../vendor/autoload.php';

// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
if (is_array($env = @include dirname(__DIR__) . '/.env.local.php')) {
$_SERVER += $env;
$_ENV += $env;
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv())->loadEnv(dirname(__DIR__).'/.env');
(new Dotenv())->loadEnv(dirname(__DIR__) . '/.env');
}

$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
5 changes: 2 additions & 3 deletions tests/Application/config/bundles.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Expand Down Expand Up @@ -31,9 +33,7 @@
Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true],
Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true],
Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true],
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
Sonata\IntlBundle\SonataIntlBundle::class => ['all' => true],
Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Expand All @@ -44,7 +44,6 @@
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true],
Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true],
Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true],
Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
Expand Down
4 changes: 0 additions & 4 deletions tests/Application/config/packages/sonata_core.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions tests/Application/config/packages/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ twig:
paths: ['%kernel.project_dir%/templates']
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'

services:
_defaults:
public: false
autowire: true
autoconfigure: true

Twig\Extra\Intl\IntlExtension: ~
7 changes: 5 additions & 2 deletions tests/Application/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"dependencies": {
"babel-polyfill": "^6.26.0",
"jquery": "^3.2.0",
"chart.js": "^2.9.3",
"jquery": "^3.5.0",
"jquery.dirtyforms": "^2.0.0",
"lightbox2": "^2.9.0",
"semantic-ui-css": "^2.2.0"
"semantic-ui-css": "^2.2.0",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
"babel-core": "^6.26.3",
Expand Down
6 changes: 4 additions & 2 deletions tests/Application/public/index.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

use Tests\Acme\SyliusExamplePlugin\Application\Kernel;
declare(strict_types=1);

use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
use Tests\Acme\SyliusExamplePlugin\Application\Kernel;

require dirname(__DIR__).'/config/bootstrap.php';
require dirname(__DIR__) . '/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);
Expand Down
8 changes: 3 additions & 5 deletions tests/Behat/Page/External/Przelewy24CheckoutPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\BrowserKit\AbstractBrowser;
use Symfony\Component\BrowserKit\Client;
use Tests\BitBag\SyliusPrzelewy24Plugin\Behat\Service\Mocker\Przelewy24ApiMocker;

Expand All @@ -43,7 +44,7 @@ public function __construct(
Przelewy24ApiMocker $przelewy24ApiMocker,
RepositoryInterface $securityTokenRepository,
EntityRepository $paymentRepository,
Client $client
AbstractBrowser $client
) {
parent::__construct($session, $parameters);

Expand All @@ -68,10 +69,7 @@ public function pay(): void

$this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function () use ($notifyToken, $postData, $captureToken) {
$this->client->request('POST', $notifyToken->getTargetUrl(), $postData);

sleep(1);

$this->getDriver()->visit($captureToken->getAfterUrl());
$this->getDriver()->visit($captureToken->getTargetUrl());
});
}

Expand Down

0 comments on commit 0ae9dcc

Please sign in to comment.