diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 99ed9722..de0ad64b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,22 +11,26 @@ on:
jobs:
tests:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-18.04
- name: "PHP ${{ matrix.php }}, MySQL ${{ matrix.mysql }}, Sylius ${{ matrix.sylius }}"
+ name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
strategy:
fail-fast: false
matrix:
php: [7.4, 7.3]
+ symfony: [^4.4, ^5.2]
+ sylius: [~1.8.0, ~1.9.0@beta]
node: [10.x]
mysql: [5.7, 8.0]
- sylius: [1.8.*]
exclude:
-
php: 7.3
mysql: 8.0
+ -
+ sylius: ~1.8.0
+ symfony: ^5.2
env:
APP_ENV: test
@@ -92,15 +96,23 @@ jobs:
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-
- - name: Prepare migrations
- run: |
- composer require sylius-labs/doctrine-migrations-extra-bundle --no-interaction --no-update
-
-
name: Install Sylius version
run: |
composer require "sylius/sylius:${{ matrix.sylius }}" --no-update
+ -
+ name: Restrict Symfony version
+ if: matrix.symfony != ''
+ run: |
+ composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
+ composer config extra.symfony.require "${{ matrix.symfony }}"
+
+ -
+ name: Restrict Sylius version
+ if: matrix.sylius != ''
+ run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
+
-
name: Install PHP dependencies
run: composer update --no-interaction
@@ -161,7 +173,7 @@ jobs:
-
name: Run Behat
- run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun
+ run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun
-
name: Upload Behat logs
diff --git a/README.md b/README.md
index e614e8b7..6846f0b8 100644
--- a/README.md
+++ b/README.md
@@ -57,14 +57,6 @@ It is used by `KnpSnappyBundle` and can be configured according to [their documm
cp -R vendor/sylius/refund-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/
```
-4. (optional) If you don't use `symfony/messenger` component yet, it is required to configure one of the message buses as a default bus:
-
- ```yaml
- framework:
- messenger:
- default_bus: sylius_refund_plugin.command_bus
- ```
-
#### Beware!
This installation instruction assumes that you're using Symfony Flex. If you don't, take a look at the
diff --git a/composer.json b/composer.json
index 62f1d58c..d0f848a9 100644
--- a/composer.json
+++ b/composer.json
@@ -23,33 +23,33 @@
"knplabs/knp-snappy-bundle": "^1.7",
"myclabs/php-enum": "^1.7",
"sylius/resource-bundle": "^1.6",
- "sylius/sylius": "^1.8",
- "symfony/messenger": "^4.4"
+ "sylius/sylius": "~1.8.0 || ~1.9.0@beta",
+ "symfony/messenger": "^4.4 || ^5.2"
},
"require-dev": {
"behat/behat": "^3.6",
- "behat/mink": "^1.8",
- "behat/mink-browserkit-driver": "^1.3",
- "behat/mink-extension": "^2.3",
"behat/mink-selenium2-driver": "^1.4",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
+ "friends-of-behat/mink": "^1.8",
+ "friends-of-behat/mink-browserkit-driver": "^1.3",
+ "friends-of-behat/mink-extension": "^2.3",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
+ "friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"lakion/mink-debug-extension": "^1.2.3",
"phpspec/phpspec": "^6.0",
"phpstan/phpstan": "0.12.29",
"phpstan/phpstan-webmozart-assert": "0.12.6",
"phpunit/phpunit": "^8.5",
"sylius-labs/coding-standard": "^3.2",
- "symfony/browser-kit": "^4.4",
- "symfony/debug-bundle": "^4.4",
- "symfony/dotenv": "^4.4",
- "symfony/intl": "^4.4",
- "symfony/web-profiler-bundle": "^4.4",
- "symfony/web-server-bundle": "^4.4"
+ "symfony/browser-kit": "^4.4 || ^5.2",
+ "symfony/debug-bundle": "^4.4 || ^5.2",
+ "symfony/dotenv": "^4.4 || ^5.2",
+ "symfony/intl": "^4.4 || ^5.2",
+ "symfony/web-profiler-bundle": "^4.4 || ^5.2"
},
"autoload": {
"psr-4": {
diff --git a/docs/legacy_installation.md b/docs/legacy_installation.md
index d88d7cc3..6680a832 100644
--- a/docs/legacy_installation.md
+++ b/docs/legacy_installation.md
@@ -6,7 +6,7 @@
composer require sylius/refund-plugin
```
-2. Add plugin class and other required bundles to your `AppKernel`:
+1. Add plugin class and other required bundles to your `AppKernel`:
```php
$bundles = [
@@ -15,20 +15,20 @@
];
```
-3. Import configuration:
+1. Import configuration:
```yaml
imports:
- { resource: "@SyliusRefundPlugin/Resources/config/app/config.yml" }
```
-4. Import routing:
+1. Import routing:
````yaml
sylius_refund:
resource: "@SyliusRefundPlugin/Resources/config/routing.yml"
````
-5. Configure `KnpSnappyBundle` (if you don't have it configured yet):
+1. Configure `KnpSnappyBundle` (if you don't have it configured yet):
````yaml
knp_snappy:
@@ -38,30 +38,21 @@
options: []
````
-6. Copy plugin migrations to your migrations directory (e.g. `src/Migrations`) and apply them to your database:
+1. Apply migrations to your database:
```bash
- cp -R vendor/sylius/refund-plugin/migrations/* src/Migrations
bin/console doctrine:migrations:migrate
```
-7. Copy Sylius templates overridden in plugin to your templates directory (e.g `templates/bundles/`):
+1. Copy Sylius templates overridden in plugin to your templates directory (e.g `templates/bundles/`):
```bash
mkdir -p templates/bundles/SyliusAdminBundle/
cp -R vendor/sylius/refund-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/
```
-8. Clear cache:
+1. Clear cache:
```bash
bin/console cache:clear
```
-
-9. (optional) If you don't use `symfony/messenger` component yet, it is required to configure one of the message buses as a default bus:
-
- ```yaml
- framework:
- messenger:
- default_bus: sylius_refund_plugin.command_bus
- ```
diff --git a/spec/CommandHandler/GenerateCreditMemoHandlerSpec.php b/spec/CommandHandler/GenerateCreditMemoHandlerSpec.php
index d4c98764..4e42b26a 100644
--- a/spec/CommandHandler/GenerateCreditMemoHandlerSpec.php
+++ b/spec/CommandHandler/GenerateCreditMemoHandlerSpec.php
@@ -4,7 +4,7 @@
namespace spec\Sylius\RefundPlugin\CommandHandler;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
diff --git a/spec/Creator/RefundCreatorSpec.php b/spec/Creator/RefundCreatorSpec.php
index 042b94d5..b5f344dc 100644
--- a/spec/Creator/RefundCreatorSpec.php
+++ b/spec/Creator/RefundCreatorSpec.php
@@ -4,7 +4,7 @@
namespace spec\Sylius\RefundPlugin\Creator;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use PhpSpec\ObjectBehavior;
use Sylius\RefundPlugin\Creator\RefundCreatorInterface;
use Sylius\RefundPlugin\Entity\RefundInterface;
diff --git a/spec/Generator/CreditMemoPdfFileGeneratorSpec.php b/spec/Generator/CreditMemoPdfFileGeneratorSpec.php
index 7c3cc511..8479a9e0 100644
--- a/spec/Generator/CreditMemoPdfFileGeneratorSpec.php
+++ b/spec/Generator/CreditMemoPdfFileGeneratorSpec.php
@@ -12,13 +12,13 @@
use Sylius\RefundPlugin\Generator\CreditMemoPdfFileGeneratorInterface;
use Sylius\RefundPlugin\Model\CreditMemoPdf;
use Symfony\Component\Config\FileLocatorInterface;
-use Symfony\Component\Templating\EngineInterface;
+use Twig\Environment;
final class CreditMemoPdfFileGeneratorSpec extends ObjectBehavior
{
function let(
RepositoryInterface $creditMemoRepository,
- EngineInterface $twig,
+ Environment $twig,
GeneratorInterface $pdfGenerator,
FileLocatorInterface $fileLocator
): void {
@@ -39,7 +39,7 @@ function it_implements_credit_memo_pdf_file_generator_interface(): void
function it_creates_credit_memo_pdf_with_generated_content_and_filename_basing_on_credit_memo_number(
RepositoryInterface $creditMemoRepository,
- EngineInterface $twig,
+ Environment $twig,
GeneratorInterface $pdfGenerator,
FileLocatorInterface $fileLocator,
CreditMemoInterface $creditMemo
diff --git a/spec/Generator/SequentialNumberGeneratorSpec.php b/spec/Generator/SequentialNumberGeneratorSpec.php
index a6172150..7b7a8d83 100644
--- a/spec/Generator/SequentialNumberGeneratorSpec.php
+++ b/spec/Generator/SequentialNumberGeneratorSpec.php
@@ -4,7 +4,7 @@
namespace spec\Sylius\RefundPlugin\Generator;
-use Doctrine\Common\Persistence\ObjectRepository;
+use Doctrine\Persistence\ObjectRepository;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\EntityManagerInterface;
use PhpSpec\ObjectBehavior;
diff --git a/spec/StateResolver/OrderFullyRefundedStateResolverSpec.php b/spec/StateResolver/OrderFullyRefundedStateResolverSpec.php
index e1d8716f..2fbb833e 100644
--- a/spec/StateResolver/OrderFullyRefundedStateResolverSpec.php
+++ b/spec/StateResolver/OrderFullyRefundedStateResolverSpec.php
@@ -4,7 +4,7 @@
namespace spec\Sylius\RefundPlugin\StateResolver;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use SM\Factory\FactoryInterface;
diff --git a/spec/StateResolver/OrderPartiallyRefundedStateResolverSpec.php b/spec/StateResolver/OrderPartiallyRefundedStateResolverSpec.php
index 3c1509e8..dd6adfd1 100644
--- a/spec/StateResolver/OrderPartiallyRefundedStateResolverSpec.php
+++ b/spec/StateResolver/OrderPartiallyRefundedStateResolverSpec.php
@@ -4,7 +4,7 @@
namespace spec\Sylius\RefundPlugin\StateResolver;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use SM\Factory\FactoryInterface;
diff --git a/spec/StateResolver/RefundPaymentCompletedStateApplierSpec.php b/spec/StateResolver/RefundPaymentCompletedStateApplierSpec.php
index 8301e176..c7abe83e 100644
--- a/spec/StateResolver/RefundPaymentCompletedStateApplierSpec.php
+++ b/spec/StateResolver/RefundPaymentCompletedStateApplierSpec.php
@@ -4,7 +4,7 @@
namespace spec\Sylius\RefundPlugin\StateResolver;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use PhpSpec\ObjectBehavior;
use SM\Factory\FactoryInterface as StateMachineFactoryInterface;
use SM\StateMachine\StateMachineInterface;
diff --git a/src/Action/CompleteRefundPaymentAction.php b/src/Action/CompleteRefundPaymentAction.php
index e415dab2..bf9607af 100644
--- a/src/Action/CompleteRefundPaymentAction.php
+++ b/src/Action/CompleteRefundPaymentAction.php
@@ -4,7 +4,7 @@
namespace Sylius\RefundPlugin\Action;
-use Doctrine\Common\Persistence\ObjectRepository;
+use Doctrine\Persistence\ObjectRepository;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\RefundPlugin\Entity\RefundPaymentInterface;
diff --git a/src/CommandHandler/GenerateCreditMemoHandler.php b/src/CommandHandler/GenerateCreditMemoHandler.php
index 044bc87e..903e2a1f 100644
--- a/src/CommandHandler/GenerateCreditMemoHandler.php
+++ b/src/CommandHandler/GenerateCreditMemoHandler.php
@@ -4,7 +4,7 @@
namespace Sylius\RefundPlugin\CommandHandler;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\RefundPlugin\Command\GenerateCreditMemo;
diff --git a/src/Creator/RefundCreator.php b/src/Creator/RefundCreator.php
index 35610cc8..5c3a32b5 100644
--- a/src/Creator/RefundCreator.php
+++ b/src/Creator/RefundCreator.php
@@ -4,7 +4,7 @@
namespace Sylius\RefundPlugin\Creator;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use Sylius\RefundPlugin\Exception\UnitAlreadyRefundedException;
use Sylius\RefundPlugin\Factory\RefundFactoryInterface;
use Sylius\RefundPlugin\Model\RefundType;
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php
index 71079858..4ae26459 100644
--- a/src/DependencyInjection/Configuration.php
+++ b/src/DependencyInjection/Configuration.php
@@ -14,9 +14,6 @@ final class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder(): TreeBuilder
{
- $treeBuilder = new TreeBuilder();
- $rootNode = $treeBuilder->root('sylius_refund_plugin');
-
- return $treeBuilder;
+ return new TreeBuilder('sylius_refund_plugin');
}
}
diff --git a/src/Generator/CreditMemoPdfFileGenerator.php b/src/Generator/CreditMemoPdfFileGenerator.php
index a23f6984..b44db35b 100644
--- a/src/Generator/CreditMemoPdfFileGenerator.php
+++ b/src/Generator/CreditMemoPdfFileGenerator.php
@@ -10,7 +10,7 @@
use Sylius\RefundPlugin\Exception\CreditMemoNotFound;
use Sylius\RefundPlugin\Model\CreditMemoPdf;
use Symfony\Component\Config\FileLocatorInterface;
-use Symfony\Component\Templating\EngineInterface;
+use Twig\Environment;
final class CreditMemoPdfFileGenerator implements CreditMemoPdfFileGeneratorInterface
{
@@ -19,7 +19,7 @@ final class CreditMemoPdfFileGenerator implements CreditMemoPdfFileGeneratorInte
/** @var RepositoryInterface */
private $creditMemoRepository;
- /** @var EngineInterface */
+ /** @var Environment */
private $twig;
/** @var GeneratorInterface */
@@ -36,7 +36,7 @@ final class CreditMemoPdfFileGenerator implements CreditMemoPdfFileGeneratorInte
public function __construct(
RepositoryInterface $creditMemoRepository,
- EngineInterface $twig,
+ Environment $twig,
GeneratorInterface $pdfGenerator,
FileLocatorInterface $fileLocator,
string $template,
diff --git a/src/Generator/SequentialNumberGenerator.php b/src/Generator/SequentialNumberGenerator.php
index dfbc5fd2..224c9209 100644
--- a/src/Generator/SequentialNumberGenerator.php
+++ b/src/Generator/SequentialNumberGenerator.php
@@ -4,7 +4,7 @@
namespace Sylius\RefundPlugin\Generator;
-use Doctrine\Common\Persistence\ObjectRepository;
+use Doctrine\Persistence\ObjectRepository;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\EntityManagerInterface;
use Sylius\RefundPlugin\Entity\CreditMemoSequenceInterface;
diff --git a/src/Migrations/Version20201130071338.php b/src/Migrations/Version20201130071338.php
index 8fe41cbf..2d71efe2 100644
--- a/src/Migrations/Version20201130071338.php
+++ b/src/Migrations/Version20201130071338.php
@@ -31,6 +31,11 @@ public function getDescription(): string
public function up(Schema $schema): void
{
+ $adjustmentTable = $schema->getTable('sylius_adjustment');
+ if ($adjustmentTable->hasColumn('shipment_id')) {
+ return;
+ }
+
$this->addSql('ALTER TABLE sylius_adjustment ADD shipment_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE sylius_adjustment ADD CONSTRAINT FK_ACA6E0F27BE036FC FOREIGN KEY (shipment_id) REFERENCES sylius_shipment (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_ACA6E0F27BE036FC ON sylius_adjustment (shipment_id)');
diff --git a/src/Migrations/Version20201204071301.php b/src/Migrations/Version20201204071301.php
index 27f8ee9b..6ff6c79c 100644
--- a/src/Migrations/Version20201204071301.php
+++ b/src/Migrations/Version20201204071301.php
@@ -31,6 +31,11 @@ public function getDescription(): string
public function up(Schema $schema): void
{
+ $adjustmentTable = $schema->getTable('sylius_adjustment');
+ if ($adjustmentTable->hasColumn('details')) {
+ return;
+ }
+
$this->addSql('ALTER TABLE sylius_adjustment ADD details JSON NOT NULL');
}
diff --git a/src/Resources/config/admin_routing.yml b/src/Resources/config/admin_routing.yml
index 8312386c..417d162a 100644
--- a/src/Resources/config/admin_routing.yml
+++ b/src/Resources/config/admin_routing.yml
@@ -13,7 +13,7 @@ sylius_refund_credit_memo:
resource: |
alias: sylius_refund.credit_memo
section: admin
- templates: SyliusAdminBundle:Crud
+ templates: "@SyliusAdmin\\Crud"
only: ['index']
grid: sylius_refund_credit_memo
permission: true
diff --git a/src/Resources/config/services/generator.xml b/src/Resources/config/services/generator.xml
index 5721b83b..92a33ff5 100644
--- a/src/Resources/config/services/generator.xml
+++ b/src/Resources/config/services/generator.xml
@@ -22,7 +22,7 @@
-
+
@SyliusRefundPlugin/Download/creditMemo.html.twig
diff --git a/src/Resources/views/Grid/Filter/channel.html.twig b/src/Resources/views/Grid/Filter/channel.html.twig
index e43316fc..81480fcd 100644
--- a/src/Resources/views/Grid/Filter/channel.html.twig
+++ b/src/Resources/views/Grid/Filter/channel.html.twig
@@ -1,3 +1,3 @@
-{% form_theme form 'SyliusUiBundle:Form:theme.html.twig' %}
+{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
{{ form_row(form) }}
diff --git a/src/Resources/views/orderRefunds.html.twig b/src/Resources/views/orderRefunds.html.twig
index f557ca6e..89694c5c 100644
--- a/src/Resources/views/orderRefunds.html.twig
+++ b/src/Resources/views/orderRefunds.html.twig
@@ -1,4 +1,4 @@
-{% extends 'SyliusAdminBundle::layout.html.twig' %}
+{% extends '@SyliusAdmin/layout.html.twig' %}
{% block title %}{{ 'sylius.ui.order'|trans ~' #'~ order.number }} {{ 'sylius_refund.ui.refunds'|trans }} {{ parent() }}{% endblock %}
diff --git a/src/StateResolver/OrderFullyRefundedStateResolver.php b/src/StateResolver/OrderFullyRefundedStateResolver.php
index ee0c948b..18f6e6fa 100644
--- a/src/StateResolver/OrderFullyRefundedStateResolver.php
+++ b/src/StateResolver/OrderFullyRefundedStateResolver.php
@@ -4,7 +4,7 @@
namespace Sylius\RefundPlugin\StateResolver;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use SM\Factory\FactoryInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\OrderPaymentStates;
diff --git a/src/StateResolver/OrderPartiallyRefundedStateResolver.php b/src/StateResolver/OrderPartiallyRefundedStateResolver.php
index 4ed218de..90d25c4f 100644
--- a/src/StateResolver/OrderPartiallyRefundedStateResolver.php
+++ b/src/StateResolver/OrderPartiallyRefundedStateResolver.php
@@ -4,7 +4,7 @@
namespace Sylius\RefundPlugin\StateResolver;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use SM\Factory\FactoryInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\OrderPaymentStates;
diff --git a/src/StateResolver/RefundPaymentCompletedStateApplier.php b/src/StateResolver/RefundPaymentCompletedStateApplier.php
index 570d5408..45bc1133 100644
--- a/src/StateResolver/RefundPaymentCompletedStateApplier.php
+++ b/src/StateResolver/RefundPaymentCompletedStateApplier.php
@@ -4,7 +4,7 @@
namespace Sylius\RefundPlugin\StateResolver;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
use SM\Factory\FactoryInterface as StateMachineFactoryInterface;
use Sylius\RefundPlugin\Entity\RefundPaymentInterface;
diff --git a/tests/Application/.env b/tests/Application/.env
index 716bf2a3..7bc6c1e6 100644
--- a/tests/Application/.env
+++ b/tests/Application/.env
@@ -12,7 +12,7 @@ APP_SECRET=EDITME
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
-DATABASE_URL=mysql://root@127.0.0.1/sylius_refund_plugin_%kernel.environment%?serverVersion=5.5
+DATABASE_URL=mysql://root@127.0.0.1/sylius_refund_plugin_%kernel.environment%
###< doctrine/doctrine-bundle ###
###> symfony/swiftmailer-bundle ###
diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php
index 0da88b30..6038b297 100644
--- a/tests/Application/Kernel.php
+++ b/tests/Application/Kernel.php
@@ -6,11 +6,13 @@
use ProxyManager\Proxy\VirtualProxyInterface;
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
+use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
@@ -39,33 +41,29 @@ public function getLogDir(): string
public function registerBundles(): iterable
{
- $contents = require $this->getProjectDir() . '/config/bundles.php';
- foreach ($contents as $class => $envs) {
- if (isset($envs['all']) || isset($envs[$this->environment])) {
- yield new $class();
- }
+ foreach ($this->getConfigurationDirectories() as $confDir) {
+ yield from $this->registerBundlesFromFile($confDir . '/bundles.php');
}
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
- $container->addResource(new FileResource($this->getProjectDir() . '/config/bundles.php'));
+ foreach ($this->getConfigurationDirectories() as $confDir) {
+ $container->addResource(new FileResource($confDir . '/bundles.php'));
+ }
+
$container->setParameter('container.dumper.inline_class_loader', true);
- $confDir = $this->getProjectDir() . '/config';
- $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
+ foreach ($this->getConfigurationDirectories() as $confDir) {
+ $this->loadContainerConfiguration($loader, $confDir);
+ }
}
protected function configureRoutes(RouteCollectionBuilder $routes): void
{
- $confDir = $this->getProjectDir() . '/config';
-
- $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
- $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
- $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
+ foreach ($this->getConfigurationDirectories() as $confDir) {
+ $this->loadRoutesConfiguration($routes, $confDir);
+ }
}
protected function getContainerBaseClass(): string
@@ -81,4 +79,41 @@ private function isTestEnvironment(): bool
{
return 0 === strpos($this->getEnvironment(), 'test');
}
+
+ private function loadContainerConfiguration(LoaderInterface $loader, string $confDir): void
+ {
+ $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
+ $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
+ $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
+ $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
+ }
+
+ private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void
+ {
+ $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
+ $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
+ $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
+ }
+
+ /**
+ * @return BundleInterface[]
+ */
+ private function registerBundlesFromFile(string $bundlesFile): iterable
+ {
+ $contents = require $bundlesFile;
+ foreach ($contents as $class => $envs) {
+ if (isset($envs['all']) || isset($envs[$this->environment])) {
+ yield new $class();
+ }
+ }
+ }
+
+ /**
+ * @return string[]
+ */
+ private function getConfigurationDirectories(): iterable
+ {
+ yield $this->getProjectDir() . '/config';
+ yield $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION;
+ }
}
diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php
index 2ac911a9..9d9790cc 100644
--- a/tests/Application/config/bundles.php
+++ b/tests/Application/config/bundles.php
@@ -7,7 +7,6 @@
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
- Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true],
Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true],
Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true],
@@ -40,12 +39,10 @@
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
- WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true],
Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true],
Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
- Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['all' => true],
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml
index 8ad31ca4..aa0c8387 100644
--- a/tests/Application/config/packages/_sylius.yaml
+++ b/tests/Application/config/packages/_sylius.yaml
@@ -6,6 +6,8 @@ imports:
- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }
+ - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" }
+
parameters:
sylius_core.public_dir: '%kernel.project_dir%/public'
diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml
index e74ed811..9b445011 100644
--- a/tests/Application/config/packages/framework.yaml
+++ b/tests/Application/config/packages/framework.yaml
@@ -2,6 +2,5 @@ framework:
secret: '%env(APP_SECRET)%'
form: true
csrf_protection: true
- templating: { engines: ["twig"] }
session:
handler_id: ~
diff --git a/tests/Application/config/packages/sylius_refund.yaml b/tests/Application/config/packages/sylius_refund.yaml
index e220f095..ce7ff8ae 100644
--- a/tests/Application/config/packages/sylius_refund.yaml
+++ b/tests/Application/config/packages/sylius_refund.yaml
@@ -1,6 +1,2 @@
imports:
- { resource: "@SyliusRefundPlugin/Resources/config/app/config.yml" }
-
-framework:
- messenger:
- default_bus: sylius_refund_plugin.command_bus
diff --git a/tests/Application/config/packages/test/sylius_refund.yaml b/tests/Application/config/packages/test/sylius_refund.yaml
deleted file mode 100644
index 7e7dcfa9..00000000
--- a/tests/Application/config/packages/test/sylius_refund.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-framework:
- messenger:
- default_bus: sylius_refund_plugin.command_bus
diff --git a/tests/Application/config/sylius/1.8/bundles.php b/tests/Application/config/sylius/1.8/bundles.php
new file mode 100644
index 00000000..74ee2bc0
--- /dev/null
+++ b/tests/Application/config/sylius/1.8/bundles.php
@@ -0,0 +1,6 @@
+ ['all' => true],
+ WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
+];
diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml
similarity index 100%
rename from tests/Application/config/packages/dev/jms_serializer.yaml
rename to tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml
diff --git a/tests/Application/config/sylius/1.8/packages/framework.yaml b/tests/Application/config/sylius/1.8/packages/framework.yaml
new file mode 100644
index 00000000..62f82d35
--- /dev/null
+++ b/tests/Application/config/sylius/1.8/packages/framework.yaml
@@ -0,0 +1,2 @@
+framework:
+ templating: { engines: ["twig"] }
diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/jms_serializer.yaml
similarity index 100%
rename from tests/Application/config/packages/jms_serializer.yaml
rename to tests/Application/config/sylius/1.8/packages/jms_serializer.yaml
diff --git a/tests/Application/config/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml
similarity index 100%
rename from tests/Application/config/packages/prod/jms_serializer.yaml
rename to tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml
diff --git a/tests/Application/config/routes/dev/twig.yaml b/tests/Application/config/sylius/1.8/routes/dev/twig.yaml
similarity index 100%
rename from tests/Application/config/routes/dev/twig.yaml
rename to tests/Application/config/sylius/1.8/routes/dev/twig.yaml
diff --git a/tests/Application/config/sylius/1.9/bundles.php b/tests/Application/config/sylius/1.9/bundles.php
new file mode 100644
index 00000000..bd33f4ae
--- /dev/null
+++ b/tests/Application/config/sylius/1.9/bundles.php
@@ -0,0 +1,6 @@
+ ['all' => true],
+ SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
+];
diff --git a/tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml
new file mode 100644
index 00000000..2f32a9b1
--- /dev/null
+++ b/tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml
@@ -0,0 +1,12 @@
+jms_serializer:
+ visitors:
+ json_serialization:
+ options:
+ - JSON_PRETTY_PRINT
+ - JSON_UNESCAPED_SLASHES
+ - JSON_PRESERVE_ZERO_FRACTION
+ json_deserialization:
+ options:
+ - JSON_PRETTY_PRINT
+ - JSON_UNESCAPED_SLASHES
+ - JSON_PRESERVE_ZERO_FRACTION
diff --git a/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml
new file mode 100644
index 00000000..ed7bc613
--- /dev/null
+++ b/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml
@@ -0,0 +1,4 @@
+jms_serializer:
+ visitors:
+ xml_serialization:
+ format_output: '%kernel.debug%'
diff --git a/tests/Application/config/sylius/1.9/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/prod/jms_serializer.yaml
new file mode 100644
index 00000000..c2881820
--- /dev/null
+++ b/tests/Application/config/sylius/1.9/packages/prod/jms_serializer.yaml
@@ -0,0 +1,10 @@
+jms_serializer:
+ visitors:
+ json_serialization:
+ options:
+ - JSON_UNESCAPED_SLASHES
+ - JSON_PRESERVE_ZERO_FRACTION
+ json_deserialization:
+ options:
+ - JSON_UNESCAPED_SLASHES
+ - JSON_PRESERVE_ZERO_FRACTION
diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php
index b35db626..7840b152 100644
--- a/tests/Application/public/index.php
+++ b/tests/Application/public/index.php
@@ -1,10 +1,12 @@
-
+
@@ -63,7 +63,7 @@
-
+