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

OP-267/Sylius 1.12 and 1.13 support #27

Merged
merged 30 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
877a733
Remove old config files
marekrzytki May 14, 2024
e7676a8
Update packages
marekrzytki May 14, 2024
272b54a
Update changes:
marekrzytki May 14, 2024
44f7c03
Fix tests
marekrzytki May 14, 2024
245b001
Fix typo
marekrzytki May 14, 2024
274cba2
Update coding standard packages version
marekrzytki May 14, 2024
4c3092f
Upgrade PHP version to 8.2
marekrzytki May 14, 2024
c294c2f
PHP stan fix
marekrzytki May 14, 2024
18c9900
Fix php version in CI
marekrzytki May 14, 2024
64608ce
Remove conflicts from composer
marekrzytki May 14, 2024
3a30353
Remove php stan package, update BitBag coding standard
marekrzytki May 14, 2024
536b8cd
Php stan fixes
marekrzytki May 14, 2024
f62205c
Ecs fixes
marekrzytki May 14, 2024
d1a939b
Remove psalm package, change friendsofsymfony/oauth-server-bundle ver…
marekrzytki May 14, 2024
946ccaf
Fix build typo
marekrzytki May 14, 2024
cfe2559
Add mailhog docker
marekrzytki May 17, 2024
c5855d0
Adjust behat tests to Sylius 1.13
marekrzytki May 17, 2024
db5761b
Coding standard fixes
marekrzytki May 17, 2024
ec11a89
Remove oauth symfony bundle
marekrzytki May 20, 2024
728da89
Remove sensiolabs security checker package
marekrzytki May 20, 2024
77033c7
Symfony upgrade configuration property
marekrzytki May 20, 2024
d8e146d
Add php stan ignore
marekrzytki May 20, 2024
288b352
Symfony upgrade changes
marekrzytki May 20, 2024
cccbdfc
Replace incorrect class
marekrzytki May 20, 2024
7e3aaa9
Increase js wait time in behat
marekrzytki May 20, 2024
8561a72
Use getContainer method
marekrzytki May 20, 2024
2e5f594
Add doctrine annotations package
marekrzytki May 20, 2024
5aebc60
Add more php versions support
marekrzytki May 22, 2024
b12ee94
Add documentation about docker image
marekrzytki May 22, 2024
aee3fb1
Increase wait time in randomly failing behat scenario
marekrzytki May 22, 2024
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
21 changes: 9 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0", "7.4"]
symfony: ["^4.4", "^5.2"]
sylius: ["~1.9.6", "~1.10.0", "~1.11.0"]
php: ["8.2"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not 8.1 and 8.2?

symfony: ["^5.4", "^6.0"]
sylius: ["~1.12.0", "~1.13.0"]
node: ["14.x"]
mysql: ["8.0"]
state_machine_adapter: ["winzou_state_machine", "symfony_workflow"]

exclude:
- sylius: ~1.9.6
php: 8.0

- sylius: ~1.10.0
symfony: 4.4

- sylius: ~1.11.0
php: 7.4
-
sylius: ~1.12.0
state_machine_adapter: "symfony_workflow"

env:
APP_ENV: test
Expand Down Expand Up @@ -129,6 +125,7 @@ jobs:
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-

-
name: Install JS dependencies
run: (cd tests/Application && yarn install)
Expand Down Expand Up @@ -178,7 +175,7 @@ jobs:

- name: Run PHPUnit
run: ./vendor/bin/phpunit --coverage-text

- name: Failed build Slack notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/coding_standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0", "7.4"]
symfony: ["^4.4", "^5.2"]
sylius: ["~1.9.6", "~1.10.0", "~1.11.0"]
php: ["8.2"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8.1 and 8.2?

symfony: ["^5.4", "^6.0"]
sylius: ["~1.12.0", "~1.13.0"]
node: ["14.x"]
mysql: ["8.0"]
state_machine_adapter: ["winzou_state_machine", "symfony_workflow"]

exclude:
- sylius: ~1.9.6
php: 8.0

- sylius: ~1.10.0
symfony: 4.4

- sylius: ~1.11.0
php: 7.4
-
sylius: ~1.12.0
state_machine_adapter: "symfony_workflow"

env:
APP_ENV: test
Expand Down Expand Up @@ -81,15 +77,15 @@ jobs:
name: Install PHP dependencies
run: composer install --no-interaction

-
-
name: Run ECS
run: vendor/bin/ecs

-
name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/
-
run: vendor/bin/phpstan analyse -c phpstan.neon

-
name: Failed build Slack notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
Expand Down
35 changes: 12 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
],
"license": "MIT",
"require": {
"php": "^7.4 || ^8.0",
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0",
"twig/inky-extra": "^3.3"
"php": "^8.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^8.1?

"sylius/sylius": "~1.12.0 || ~1.13.0",
"twig/inky-extra": "^3.3",
"doctrine/annotations": "^1.14"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"bitbag/coding-standard": "^1.0",
"behat/behat": "^3.7",
"behat/mink-selenium2-driver": "~1.6.0",
"bitbag/coding-standard": "^3.0.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
Expand All @@ -27,30 +28,18 @@
"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",
"lchrusciel/api-test-case": "^5.2",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.85",
"phpstan/phpstan-doctrine": "0.12.33",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^4.0",
"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",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.13",
"vimeo/psalm": "4.7.1",
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
},
"conflict": {
"doctrine/dbal": "^3.0",
"doctrine/orm": ">=2.15.2"
},
"config": {
"sort-packages": true,
"allow-plugins": {
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.4'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write in README.md or similar, how to test the e-mails

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the docker-compose -f DIR/docker-compose.mailhog.yaml up command and the ports mapping information.


services:
mailhog:
# do not use in production!
image: mailhog/mailhog:latest
environment:
- MH_STORAGE=maildir
# volumes:
# - ./docker/mailhog/maildir:/maildir:rw,delegated
ports:
- "8025:8025"
- "1025:1025"
23 changes: 8 additions & 15 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<?php

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
declare(strict_types=1);

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
use Symplify\EasyCodingStandard\Config\ECSConfig;

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/spec',
]);
$parameters->set(Option::SKIP, [
__DIR__ . '/tests/Application',
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
return static function (ECSConfig $config): void {

putenv('ALLOW_BITBAG_OS_HEADER=1');

$config->import('vendor/bitbag/coding-standard/ecs.php');
$config->paths(['src', 'spec', 'tests/Repository', 'tests/Behat']);
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Feature: Receiving confirmation email after finalizing checkout

@ui @email
Scenario: Receiving a custom confirmation email after finalizing checkout
Given there is mail template with "order_confirmation" type and "Order confirmation" name and "Congratulations, you have bought new gun" subject and "Pif paf </br> {{order.number}}" content
Given there is mail template with "order_confirmation" type and "Order confirmation" name and "Congratulations, you have bought new gun" subject and "Pif paf {{order.number}}" content
And I have product "Sig Sauer P226" in the cart
And I have completed addressing step with email "[email protected]" and "United States" based billing address
And I have proceeded order with "Free" shipping method and "Offline" payment
Expand Down
6 changes: 3 additions & 3 deletions features/shop/receiving_user_registration_emails.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Receiving set of welcoming emails after registration

@ui @email
Scenario: Receiving a custom welcoming email after registration
Given there is mail template with "user_registration" type and "User registration" name and "Welcome to our shop!" subject and "Enjoy our stuff!" content
Given there is mail template with "verification_token" type and "User registration" name and "Welcome to our shop!" subject and "Enjoy our stuff!" content
When I register with email "[email protected]" and password "suitsarelife"
Then a welcoming email should have been sent to "[email protected]"

Expand All @@ -24,7 +24,7 @@ Feature: Receiving set of welcoming emails after registration
When I register with email "[email protected]" and password "suitsarelife"
Then I should be notified that my account has been created and the verification email has been sent
And a default account verification email should have been sent to "[email protected]"
And 2 emails should be sent to "[email protected]"
And emails should be sent to "[email protected]" depending on Sylius version
But I should not be able to log in as "[email protected]" with "suitsarelife" password

@ui @email
Expand All @@ -33,5 +33,5 @@ Feature: Receiving set of welcoming emails after registration
When I register with email "[email protected]" and password "suitsarelife"
Then I should be notified that my account has been created and the verification email has been sent
And a custom account verification email should have been sent to "[email protected]"
And 2 emails should be sent to "[email protected]"
And emails should be sent to "[email protected]" depending on Sylius version
But I should not be able to log in as "[email protected]" with "suitsarelife" password
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Feature: Sending a confirmation email after shipping an order

@ui @email
Scenario: Sending a custom confirmation email after shipping an order
Given there is mail template with "shipment_confirmation" type and "Shipment confirmation" name and "Your products are waiting for you!" subject and "Enjoy your new stuff! </br> {{order.number}} </br> {{ shipment.method.name }} </br> {{shipment.tracking}}" content
Given there is mail template with "shipment_confirmation" type and "Shipment confirmation" name and "Your products are waiting for you!" subject and "Enjoy your new stuff! {{order.number}} {{ shipment.method.name }} {{shipment.tracking}}" content
When I view the summary of the order "#00000666"
And specify its tracking code as "#00044"
And I ship this order
Expand Down
22 changes: 7 additions & 15 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
includes:
- vendor/bitbag/coding-standard/phpstan.neon
parameters:
level: 8
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false

excludes_analyse:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'

# Test dependencies
- 'tests/Application/*'

# ECS Fixer dependency
- 'src/Fixer'
ignoreErrors:
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
excludePaths:
- tests/Repository
paths:
- src
- tests
17 changes: 9 additions & 8 deletions spec/EmailSender/SenderSpec.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);
Expand Down Expand Up @@ -41,14 +42,14 @@ function it_is_initializable(
SenderAdapterInterface $senderAdapter,
EmailProviderInterface $provider,
DefaultSettingsProviderInterface $defaultSettingsProvider,
EmailTemplateTranslationRepositoryInterface $templateTranslationRepository
EmailTemplateTranslationRepositoryInterface $templateTranslationRepository,
): void {
$this->beConstructedWith(
$rendererAdapter,
$senderAdapter,
$provider,
$defaultSettingsProvider,
$templateTranslationRepository
$templateTranslationRepository,
);
$this->shouldHaveType(Sender::class);
}
Expand All @@ -60,7 +61,7 @@ function it_should_send_email(
DefaultSettingsProviderInterface $defaultSettingsProvider,
EmailTemplateTranslationRepositoryInterface $templateTranslationRepository,
EmailInterface $email,
RenderedEmail $renderedEmail
RenderedEmail $renderedEmail,
): void {
$this->beConstructedWith(
$rendererAdapter,
Expand Down Expand Up @@ -102,7 +103,7 @@ function it_should_set_custom_email_template_if_found(
DefaultSettingsProviderInterface $defaultSettingsProvider,
EmailTemplateTranslationRepositoryInterface $templateTranslationRepository,
EmailInterface $email,
RenderedEmail $renderedEmail
RenderedEmail $renderedEmail,
): void {
$this->beConstructedWith(
$rendererAdapter,
Expand All @@ -122,7 +123,7 @@ function it_should_set_custom_email_template_if_found(
$emailTemplateTranslation = new EmailTemplateTranslation();
$templateTranslationRepository->findOneByLocaleCodeAndType(
self::LOCALE,
self::EMAIL_TYPE
self::EMAIL_TYPE,
)->willReturn($emailTemplateTranslation);

$rendererAdapter->render($email, Argument::type('array'))->willReturn($renderedEmail);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);
Expand All @@ -15,7 +16,6 @@
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
Expand All @@ -31,7 +31,7 @@ function let(
DataCollectorTranslator $dataCollectorTranslator,
RouterInterface $router,
Request $request,
ParameterBagInterface $attributes
ParameterBagInterface $attributes,
): void {
$request->attributes = $attributes;

Expand All @@ -46,10 +46,12 @@ function it_is_initializable(): void
function it_should_do_nothing_when_route_is_not_create_email_template(
RequestEvent $requestEvent,
Request $request,
ParameterBag $attributes,
EmailCodesProviderInterface $emailCodesProvider
ParameterBagInterface $attributes,
EmailCodesProviderInterface $emailCodesProvider,
Session $session,
): void {
$requestEvent->getRequest()->willReturn($request);
$request->getSession()->willReturn($session);

$attributes->get('_route')->shouldBeCalled()->willReturn('wrong_route');

Expand All @@ -61,10 +63,10 @@ function it_should_do_nothing_when_route_is_not_create_email_template(
function it_should_not_redirect_when_type_are_available_to_create_email_template(
RequestEvent $requestEvent,
Request $request,
ParameterBag $attributes,
ParameterBagInterface $attributes,
EmailCodesProviderInterface $emailCodesProvider,
Session $session,
FlashBagInterface $flashBag
FlashBagInterface $flashBag,
): void {
$requestEvent->getRequest()->willReturn($request);

Expand All @@ -85,12 +87,12 @@ function it_should_not_redirect_when_type_are_available_to_create_email_template
function it_should_redirect_when_route_is_create_email_template(
RequestEvent $requestEvent,
Request $request,
ParameterBag $attributes,
ParameterBagInterface $attributes,
EmailCodesProviderInterface $emailCodesProvider,
Session $session,
FlashBagInterface $flashBag,
RouterInterface $router,
DataCollectorTranslator $dataCollectorTranslator
DataCollectorTranslator $dataCollectorTranslator,
): void {
$requestEvent->getRequest()->willReturn($request);

Expand Down
Loading
Loading