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

Upgrade to Sylius 1.9 with Symfony 5 #246

Closed
wants to merge 4 commits into from
Closed
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
41 changes: 37 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ jobs:
php: [7.4, 7.3]
node: [10.x]
mysql: [5.7, 8.0]
sylius: [1.8.*]
sylius: [dev-master, 1.8.*]

exclude:
-
php: 7.3
mysql: 8.0
-
php: 7.3
sylius: dev-master

env:
APP_ENV: test
Expand Down Expand Up @@ -78,6 +81,26 @@ jobs:
name: Run webserver
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)

-
name: Install Sylius version
run: |
composer require "sylius/sylius:${{ matrix.sylius }}" --no-update

-
name: Prepare proper configuration for version using sylius/sylius 1.9
if: matrix.sylius != '1.8.*'
run: |
composer require babdev/pagerfanta-bundle

-
name: Prepare proper configuration for version using sylius/sylius 1.8
if: matrix.sylius == '1.8.*'
run: |
cp etc/sylius18/config/packages/dev/jms_serializer.yaml tests/Application/config/packages/dev/
cp etc/sylius18/config/packages/prod/jms_serializer.yaml tests/Application/config/packages/prod/
cp etc/sylius18/config/packages/jms_serializer.yaml tests/Application/config/packages/
composer require white-october/pagerfanta-bundle

-
name: Get Composer cache directory
id: composer-cache
Expand Down Expand Up @@ -124,10 +147,20 @@ jobs:
run: (cd tests/Application && yarn install)

-
name: Prepare test application database
name: Create test application database
run: (cd tests/Application && bin/console doctrine:database:create -vvv)

-
name: Exclude duplicated migrations
if: matrix.sylius != '1.8.*'
run: |
(cd tests/Application && bin/console doctrine:database:create -vvv)
(cd tests/Application && bin/console doctrine:migrations:migrate -n -vvv -q)
(cd tests/Application && bin/console doctrine:migration:sync-metadata-storage)
(cd tests/Application && bin/console doctrine:migrations:version 'Sylius\RefundPlugin\Migrations\Version20201204071301' --add)
(cd tests/Application && bin/console doctrine:migrations:version 'Sylius\RefundPlugin\Migrations\Version20201130071338' --add)

-
name: Prepare test application database
run: (cd tests/Application && bin/console doctrine:migrations:migrate -n -vvv -q)

-
name: Prepare test application assets
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default:
extensions:
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~

Lakion\Behat\MinkDebugExtension:
FriendsOfBehat\MinkDebugExtension:
directory: etc/build
clean_start: false
screenshot: true
Expand Down
20 changes: 11 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,28 @@
],
"require": {
"php": "^7.3",
"knplabs/knp-snappy-bundle": "^1.7",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"jms/serializer-bundle": "^2.4 || ^3.5",
"doctrine/doctrine-migrations-bundle": "^3.0",
"knplabs/knp-snappy-bundle": "^1.8",
"myclabs/php-enum": "^1.7",
"sylius/resource-bundle": "^1.6",
"sylius/sylius": "^1.8",
"sylius/resource-bundle": "^1.6 || ^1.7",
"symfony/messenger": "^4.4"
},
"require-dev": {
"behat/behat": "^3.6",
"behat/mink": "^1.8",
"behat/mink-browserkit-driver": "^1.3",
"behat/mink-extension": "^2.3",
"behat/behat": "^3.6.1",
"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.4",
"friends-of-behat/mink-debug-extension": "^2.0",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"lakion/mink-debug-extension": "^1.2.3",
"phpspec/phpspec": "^6.0",
"phpspec/phpspec": "^7.0",
"phpstan/phpstan": "0.12.29",
"phpstan/phpstan-webmozart-assert": "0.12.6",
"phpunit/phpunit": "^8.5",
Expand Down
8 changes: 0 additions & 8 deletions docs/legacy_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,3 @@
```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
```
7 changes: 7 additions & 0 deletions etc/sylius18/config/packages/dev/jms_serializer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
jms_serializer:
visitors:
json:
options:
- JSON_PRETTY_PRINT
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION
4 changes: 4 additions & 0 deletions etc/sylius18/config/packages/jms_serializer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jms_serializer:
visitors:
xml:
format_output: '%kernel.debug%'
6 changes: 6 additions & 0 deletions etc/sylius18/config/packages/prod/jms_serializer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jms_serializer:
visitors:
json:
options:
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION
2 changes: 1 addition & 1 deletion spec/CommandHandler/GenerateCreditMemoHandlerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion spec/Creator/RefundCreatorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions spec/Generator/CreditMemoPdfFileGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/Generator/SequentialNumberGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace spec\Sylius\RefundPlugin\Generator;

use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectRepository;
use PhpSpec\ObjectBehavior;
use Sylius\RefundPlugin\Entity\CreditMemoSequenceInterface;
use Sylius\RefundPlugin\Factory\CreditMemoSequenceFactoryInterface;
Expand Down
2 changes: 1 addition & 1 deletion spec/StateResolver/OrderFullyRefundedStateResolverSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Action/CompleteRefundPaymentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/CommandHandler/GenerateCreditMemoHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Creator/RefundCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 1 addition & 7 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@

final class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sylius_refund_plugin');

return $treeBuilder;
return new TreeBuilder('sylius_refund_plugin');
}
}
6 changes: 3 additions & 3 deletions src/Generator/CreditMemoPdfFileGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -19,7 +19,7 @@ final class CreditMemoPdfFileGenerator implements CreditMemoPdfFileGeneratorInte
/** @var RepositoryInterface */
private $creditMemoRepository;

/** @var EngineInterface */
/** @var Environment */
private $twig;

/** @var GeneratorInterface */
Expand All @@ -36,7 +36,7 @@ final class CreditMemoPdfFileGenerator implements CreditMemoPdfFileGeneratorInte

public function __construct(
RepositoryInterface $creditMemoRepository,
EngineInterface $twig,
Environment $twig,
GeneratorInterface $pdfGenerator,
FileLocatorInterface $fileLocator,
string $template,
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/SequentialNumberGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Sylius\RefundPlugin\Generator;

use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectRepository;
use Sylius\RefundPlugin\Entity\CreditMemoSequenceInterface;
use Sylius\RefundPlugin\Factory\CreditMemoSequenceFactoryInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;
Expand Down
27 changes: 13 additions & 14 deletions src/Resources/config/admin_routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ sylius_refund_refund_units:
defaults:
_controller: Sylius\RefundPlugin\Action\Admin\RefundUnitsAction

sylius_refund_credit_memo:
resource: |
alias: sylius_refund.credit_memo
section: admin
templates: SyliusAdminBundle:Crud
only: ['index']
grid: sylius_refund_credit_memo
permission: true
vars:
all:
subheader: sylius_refund.ui.manage_credit_memos
index:
icon: inbox
type: sylius.resource
sylius_refund_admin_credit_memo_index:
path: /credit-memos
methods: [GET]
defaults:
_controller: sylius_refund.controller.credit_memo:indexAction
_sylius:
template: "@SyliusAdmin/Crud/index.html.twig"
grid: sylius_refund_credit_memo
vars:
all:
subheader: sylius_refund.ui.manage_credit_memos
index:
icon: inbox

sylius_refund_order_credit_memos_list:
path: /orders/{orderId}/credit-memos
Expand Down
1 change: 0 additions & 1 deletion src/Resources/config/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ sylius_mailer:
framework:
messenger:
buses:
sylius_refund_plugin.command_bus: ~
sylius_refund_plugin.event_bus:
default_middleware: allow_no_handlers
Tomanhez marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/services/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</service>

<service id="Sylius\RefundPlugin\Action\Admin\RefundUnitsAction">
<argument type="service" id="sylius_refund_plugin.command_bus" />
<argument type="service" id="sylius_default.bus" />
<argument type="service" id="session" />
<argument type="service" id="router" />
<argument type="service" id="Sylius\RefundPlugin\Creator\RefundUnitsCommandCreator" />
Expand All @@ -41,7 +41,7 @@
</service>

<service id="Sylius\RefundPlugin\Action\Admin\SendCreditMemoAction">
<argument type="service" id="sylius_refund_plugin.command_bus"/>
<argument type="service" id="sylius_default.bus"/>
<argument type="service" id="sylius_refund.repository.credit_memo"/>
<argument type="service" id="session"/>
<argument type="service" id="router"/>
Expand Down
Loading