Skip to content

Commit

Permalink
Merge pull request #323 from TheMilek/SYL-3915
Browse files Browse the repository at this point in the history
Upgrade to 2.0
  • Loading branch information
GSadee authored Oct 18, 2024
2 parents 7753796 + bba54ad commit 41d1cd0
Show file tree
Hide file tree
Showing 152 changed files with 944 additions and 705 deletions.
74 changes: 36 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,38 @@ on:

jobs:
tests:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, wkhtmltopdf: ${{ matrix.wkhtmltopdf }}, State Machine Adapter ${{ matrix.state_machine_adapter }}"

strategy:
fail-fast: false
matrix:
php: ["8.1", "8.2"]
symfony: ["^5.4.21", "^6.4"]
sylius: ["~1.12.0", "~1.13.0",]
php: ["8.2", "8.3"]
symfony: ["^6.4", "^7.1"]
sylius: ["2.0.x-dev"]
node: ["20.x"]
mysql: ["8.0"]
wkhtmltopdf: ["0.12.6-1"]
state_machine_adapter: [ "winzou_state_machine", "symfony_workflow" ]
mysql: ["8.4"]
wkhtmltopdf: ["0.12.6-1", false]
state_machine_adapter: [ "symfony_workflow" ]

include:
-
php: "8.3"
symfony: "^6.4"
sylius: "~1.13.0"
symfony: "^7.1"
sylius: "2.0.x-dev"
node: "20.x"
mysql: "8.0"
mysql: "8.4"
wkhtmltopdf: "0.12.6-1"
state_machine_adapter: "symfony_workflow"
-
php: "8.2"
symfony: "^6.4"
sylius: "~1.12.0"
node: "20.x"
mysql: "8.0"
wkhtmltopdf: false
state_machine_adapter: "winzou_state_machine"
-
php: "8.2"
symfony: "^6.4"
sylius: "~1.13.0"
php: "8.3"
symfony: "^7.1"
sylius: "2.0.x-dev"
node: "20.x"
mysql: "8.0"
mysql: "8.4"
wkhtmltopdf: false
state_machine_adapter: "symfony_workflow"

exclude:
- sylius: "~1.12.0"
state_machine_adapter: "symfony_workflow"
state_machine_adapter: "winzou_state_machine"

env:
APP_ENV: test
Expand All @@ -77,7 +65,7 @@ jobs:

-
name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node }}"

Expand All @@ -94,7 +82,7 @@ jobs:

-
name: Setup cache for wkhtmltopdf
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-wkhtmltopdf
if: matrix.wkhtmltopdf != false
with:
Expand All @@ -114,7 +102,6 @@ jobs:
if: matrix.wkhtmltopdf == false
run: |
mv tests/Application/etc/sylius_invoicing_pdf_generation_disabled.yaml tests/Application/config/packages
sed -i 's/pdf_generation_disabled/pdf_generation_enabled/g' behat.yml.dist
-
name: Get Composer cache directory
Expand All @@ -123,7 +110,7 @@ jobs:

-
name: Cache Composer
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
Expand All @@ -143,6 +130,13 @@ jobs:
if: matrix.sylius != ''
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction

-
name: Require Winzou State Machine
if: "${{ matrix.state_machine_adapter == 'winzou_state_machine' }}"
run: |
composer require winzou/state-machine:^0.4 --no-update
composer require winzou/state-machine-bundle:^0.6 --no-update
-
name: Install PHP dependencies
run: composer install --no-interaction --no-scripts
Expand All @@ -154,7 +148,7 @@ jobs:

-
name: Cache Yarn
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
Expand Down Expand Up @@ -189,10 +183,9 @@ jobs:
name: Run security check
run: symfony security:check

-
name: Run analysis
run: composer analyse
if: matrix.sylius != '~1.12.0'
# -
# name: Run analysis
# run: composer analyse

-
name: Run PHPSpec
Expand All @@ -204,11 +197,16 @@ jobs:

-
name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun
run: |
if [ "${{ matrix.wkhtmltopdf }}" != "false" ]; then
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_disabled" || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun;
else
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_enabled" || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun;
fi
-
name: Upload Behat logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: Behat logs
Expand Down
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### UPGRADE FROM 0.24.X TO 1.0.0

1. Support for Sylius 2.0 has been added, it is now the recommended Sylius version to use with InvoicingPlugin.
2. Support for Sylius 1.13 and 1.12 has been dropped, upgrade your application to [Sylius 2.0](https://github.com/Sylius/Sylius/blob/2.0/UPGRADE-2.0.md).
3. Support for PHP has been increased to 8.2
4. The `sylius_invoicing_plugin_admin_order_invoices_partial` and `sylius_invoicing_plugin_shop_order_invoices_partial` partials have been replaced by `Sylius\InvoicingPlugin\Twig\Component\Invoice\ListComponent` twig component.

### UPGRADE FROM 0.24.X TO 0.25.0

1. Support for Sylius 1.13 has been added, it is now the recommended Sylius version to use with InvoicingPlugin.
Expand Down
4 changes: 0 additions & 4 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,3 @@ default:
FriendsOfBehat\SuiteSettingsExtension:
paths:
- features

FriendsOfBehat\ExcludeSpecificationsExtension:
features:
- features/managing_invoices/pdf_generation_disabled
45 changes: 23 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
"description": "Invoicing plugin for Sylius.",
"license": "MIT",
"require": {
"php": "^8.1",
"php": "^8.2",
"knplabs/knp-snappy-bundle": "^1.8",
"ramsey/uuid": "^3.9 || ^4.0",
"sylius/grid-bundle": "^1.9",
"sylius/resource-bundle": "^1.9",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"symfony/config": "^5.4 || ^6.4",
"symfony/dependency-injection": "^5.4.21 || ^6.4",
"symfony/form": "^5.4.21 || ^6.4",
"symfony/framework-bundle": "^5.4.21 || ^6.4",
"symfony/http-foundation": "^5.4.21 || ^6.4",
"symfony/http-kernel": "^5.4.21 || ^6.4",
"symfony/messenger": "^5.4.21 || ^6.4",
"symfony/options-resolver": "^5.4.21 || ^6.4",
"symfony/routing": "^5.4.21 || ^6.4"
"sylius/sylius": "2.0.x-dev",
"sylius/twig-hooks": "^0.4",
"symfony/config": "^6.4 || ^7.1",
"symfony/console": "^6.4.1 || ^7.1",
"symfony/dependency-injection": "^6.4 || ^7.1",
"symfony/form": "^6.4 || ^7.1",
"symfony/framework-bundle": "^6.4 || ^7.1",
"symfony/http-foundation": "^6.4 || ^7.1",
"symfony/http-kernel": "^6.4 || ^7.1",
"symfony/messenger": "^6.4 || ^7.1",
"symfony/options-resolver": "^6.4 || ^7.1",
"symfony/routing": "^6.4 || ^7.1"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "~1.6.0",
"friends-of-behat/exclude-specifications-extension": "^0.2 || ^0.3",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0",
Expand All @@ -33,8 +34,8 @@
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"matthiasnoback/symfony-config-test": "^4.2",
"matthiasnoback/symfony-dependency-injection-test": "^4.2",
"matthiasnoback/symfony-config-test": "^5.1",
"matthiasnoback/symfony-dependency-injection-test": "^5.0",
"phpspec/phpspec": "^7.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.8",
Expand All @@ -43,13 +44,13 @@
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "~4.0.0",
"symfony/browser-kit": "^5.4.21 || ^6.4",
"symfony/debug-bundle": "^5.4.21 || ^6.4",
"symfony/dotenv": "^5.4.21 || ^6.4",
"symfony/intl": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.15",
"symfony/web-profiler-bundle": "^5.4.21 || ^6.4"
"sylius-labs/coding-standard": "^4.2",
"symfony/browser-kit": "^6.4 || ^7.1",
"symfony/debug-bundle": "^6.4 || ^7.1",
"symfony/dotenv": "^6.4 || ^7.1",
"symfony/intl": "^6.4 || ^7.1",
"symfony/webpack-encore-bundle": "^2.1",
"symfony/web-profiler-bundle": "^6.4 || ^7.1"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -87,7 +88,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-main": "2.0-dev"
}
},
"prefer-stable": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Being unable to download an invoice on a single order view
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@ui @pdf_disabled
Scenario: Being unable to download an invoice on a single order view
When I view the summary of the order "#00000022"
Then I should not be able to download the first invoice
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Being unable to download an invoice on a single order view
And for the billing address of "Mazikeen Lilim" in the "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
And I chose "Free" shipping method with "Cash on Delivery" payment

@ui
@ui @pdf_disabled
Scenario: Being unable to download an invoice on a single order view
When I view the summary of the order "#00000666"
Then I should not be able to download the first invoice
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: Being unable to download an invoice from its details page
And for the billing address of "Mazikeen Lilim" in the "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
And the customer chose "UPS" shipping method with "Cash on Delivery" payment

@ui
@ui @pdf_disabled
Scenario: Being unable to download an invoice from its details page
Given I view the summary of the invoice for order "#00000666"
Then I should not be able to download the invoice
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Downloading invoices on a single order view
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@ui @pdf_enabled
Scenario: Downloading an invoice on order view
When I view the summary of the order "#00000022"
And I download the first invoice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Downloading invoices on a single order view
And for the billing address of "Mazikeen Lilim" in the "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
And I chose "Free" shipping method with "Cash on Delivery" payment

@ui
@ui @pdf_enabled
Scenario: Downloading an invoice on order view
When I view the summary of the order "#00000666"
And I download the first invoice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: Downloading an invoice from its details page
And for the billing address of "Mazikeen Lilim" in the "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
And the customer chose "UPS" shipping method with "Cash on Delivery" payment

@ui
@ui @pdf_enabled
Scenario: Downloading an invoice
Given I view the summary of the invoice for order "#00000666"
When I download the invoice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Saving invoices on server during generation
And the store allows paying with "Cash on Delivery"
And channel "United States" has shop billing data set as "Ragnarok", "1100110011", "Pacific Coast Hwy", "90806" "Los Angeles", "United States"

@application
@application @pdf_enabled
Scenario: Having invoice saved on the server after the order is placed
Given there is a customer "[email protected]" that placed an order "#00000666"
When the customer bought 2 "Angel T-Shirt" products
Expand Down
1 change: 1 addition & 0 deletions src/Cli/GenerateInvoicesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function execute(InputInterface $input, OutputInterface $output): int

protected function configure(): void
{
$this->setName(self::$defaultName);
$this->setDescription('Generates invoices for orders placed before InvoicingPlugin installation');
}
}
15 changes: 2 additions & 13 deletions src/Resources/config/app/routing/admin_invoicing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sylius_invoicing_plugin_invoice:
resource: |
alias: sylius_invoicing_plugin.invoice
section: admin
templates: "@SyliusAdmin\\Crud"
templates: "@SyliusAdmin\\shared\\crud"
only: ['index']
grid: sylius_invoicing_plugin_invoice
permission: true
Expand All @@ -21,7 +21,7 @@ sylius_invoicing_plugin_admin_invoice_show:
_sylius:
section: admin
permission: true
template: "@SyliusInvoicingPlugin/Invoice/show.html.twig"
template: "@SyliusAdmin/shared/crud/show.html.twig"

sylius_invoicing_plugin_admin_invoice_download:
path: /invoices/{id}/download
Expand All @@ -35,17 +35,6 @@ sylius_invoicing_plugin_admin_invoice_resend:
defaults:
_controller: sylius_invoicing_plugin.ui.action.resend_invoice

sylius_invoicing_plugin_admin_order_invoices_partial:
path: /_partial/invoices/{orderNumber}/
methods: [GET]
defaults:
_controller: sylius_invoicing_plugin.controller.invoice::indexAction
_sylius:
template: $template
repository:
method: findByOrderNumber
arguments: $orderNumber

sylius_invoicing_admin_order_show_by_number:
path: /orders/by-number/{number}
methods: [GET]
Expand Down
11 changes: 0 additions & 11 deletions src/Resources/config/app/routing/shop_invoicing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,3 @@ sylius_invoicing_plugin_shop_invoice_download:
methods: [GET]
defaults:
_controller: sylius_invoicing_plugin.ui.action.download_invoice

sylius_invoicing_plugin_shop_order_invoices_partial:
path: /_partial/invoices/{orderNumber}/
methods: [GET]
defaults:
_controller: sylius_invoicing_plugin.controller.invoice::indexAction
_sylius:
template: $template
repository:
method: findByOrderNumber
arguments: $orderNumber
Loading

0 comments on commit 41d1cd0

Please sign in to comment.