Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix/OP-285-fix-inst…
Browse files Browse the repository at this point in the history
…allation-issues
  • Loading branch information
marekrzytki committed Jun 3, 2024
2 parents 4875ba5 + ff05b95 commit 5f8bb4a
Show file tree
Hide file tree
Showing 140 changed files with 695 additions and 1,047 deletions.
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.1", "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.1", "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.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
11 changes: 11 additions & 0 deletions doc/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ $ cd ../..
$ vendor/bin/behat
$ vendor/bin/phpspec run
```
## Testing emails with quick docker setup

Steps to use mailhog docker image
- create `tests/Application/.env.local`
- copy content from `tests/Application/.env`
- `MAILER_DSN=null://null` -> comment this line
- `#MAILER_DSN=smtp://localhost:1025` -> uncomment this line
- remember to match port with docker image - by default they are set to 1025
- start docker image with `docker-compose -f docker-compose.yml up`
- you can access mailhog UI on second mapped port - by default 8025

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'

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" # UI
- "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
Loading

0 comments on commit 5f8bb4a

Please sign in to comment.