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-569: Upgrade to 1.14 #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
matrix:
php: ["8.1", "8.2"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.12.0", "~1.13.0"]
sylius: ["~1.13.0", "~1.14.0"]
node: ["14.x"]
mysql: ["8.0"]
state_machine_adapter: ["winzou_state_machine", "symfony_workflow"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coding_standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
matrix:
php: ["8.1", "8.2"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.12.0", "~1.13.0"]
sylius: ["~1.13.0", "~1.14.0"]
node: ["14.x"]
mysql: ["8.0"]
state_machine_adapter: ["winzou_state_machine", "symfony_workflow"]
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "MIT",
"require": {
"php": "^8.1",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"sylius/sylius": "~1.13.0 || ~1.14.0",
"twig/inky-extra": "^3.3"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ We work on stable, supported and up-to-date versions of packages. We recommend y
| Package | Version |
|---------------|-----------------|
| PHP | \>=8.0 |
| sylius/sylius | 1.12.x - 1.13.x |
| sylius/sylius | 1.13.x - 1.14.x |
| MySQL | \>= 5.7 |
| NodeJS | \>= 14.x |

Expand Down
55 changes: 51 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,60 @@
version: '3.4'

services:
app:
container_name: mail-template-plugin
build:
context: .
environment:
APP_ENV: "dev"
DATABASE_URL: "mysql://root:mysql@mysql/sylius_%kernel.environment%?charset=utf8mb4"
# DATABASE_URL: "pgsql://root:postgres@postgres/sylius_%kernel.environment%?charset=utf8" # When using postgres
PHP_DATE_TIMEZONE: "Europe/Warsaw"
ELASTICSEARCH_URL: "http://elasticsearch:9200/"
MAILER_DSN: "smtp://mailhog:1025"
volumes:
- ./:/app:delegated
- ./.docker/php.ini:/etc/php8/php.ini:delegated
- ./.docker/nginx.conf:/etc/nginx/nginx.conf:delegated
ports:
- 80:80
depends_on:
- mysql
networks:
- sylius

mysql:
container_name: mail-template-plugin-mysql
image: mysql:8.0
platform: linux/amd64
environment:
MYSQL_ROOT_PASSWORD: mysql
ports:
- ${MYSQL_PORT:-3306}:3306
networks:
- sylius

# postgres:
# image: postgres:14-alpine
# environment:
# POSTGRES_USER: root
# POSTGRES_PASSWORD: postgres
# ports:
# - ${POSTGRES_PORT:-5432}:5432
# networks:
# - sylius

mailhog:
container_name: mail-template-plugin-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"
- "${MAILHOG_PORT:-8025}:8025"
networks:
- sylius

networks:
sylius:
driver: bridge
4 changes: 2 additions & 2 deletions features/shop/receiving_user_registration_emails.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: Receiving set of welcoming emails after registration
When I register with email "ghastly@bespoke.com" 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 "ghastly@bespoke.com"
And emails should be sent to "ghastly@bespoke.com" depending on Sylius version
And 1 emails should be sent to "ghastly@bespoke.com"
But I should not be able to log in as "ghastly@bespoke.com" with "suitsarelife" password

@ui @email
Expand All @@ -33,5 +33,5 @@ Feature: Receiving set of welcoming emails after registration
When I register with email "ghastly@bespoke.com" 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 "ghastly@bespoke.com"
And emails should be sent to "ghastly@bespoke.com" depending on Sylius version
And 1 emails should be sent to "ghastly@bespoke.com"
But I should not be able to log in as "ghastly@bespoke.com" with "suitsarelife" password
2 changes: 1 addition & 1 deletion spec/Entity/EmailTemplateSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use BitBag\SyliusMailTemplatePlugin\Entity\EmailTemplate;
use BitBag\SyliusMailTemplatePlugin\Entity\EmailTemplateInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Resource\Model\ResourceInterface;

final class EmailTemplateSpec extends ObjectBehavior
{
Expand Down
2 changes: 1 addition & 1 deletion spec/Entity/EmailTemplateTranslationSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use BitBag\SyliusMailTemplatePlugin\Entity\EmailTemplateTranslationInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Model\TranslationInterface;
use Sylius\Resource\Model\ResourceInterface;

final class EmailTemplateTranslationSpec extends ObjectBehavior
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Prophecy\Argument;
use Sylius\Component\Core\Model\Customer;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Resource\Factory\FactoryInterface;

class CustomerPreviewDataFactorySpec extends ObjectBehavior
{
Expand Down
4 changes: 2 additions & 2 deletions spec/Repository/EmailTemplateTranslationRepositorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Doctrine\ORM\QueryBuilder;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Resource\Doctrine\Persistence\RepositoryInterface;
use Sylius\Resource\Model\ResourceInterface;

final class EmailTemplateTranslationRepositorySpec extends ObjectBehavior
{
Expand Down
6 changes: 5 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@ final class Configuration implements ConfigurationInterface
public const TWIG = 'twig';

public const ALLOWED_FILTERS = 'allowed_filters';

public const ALLOWED_FUNCTIONS = 'allowed_functions';

public const ALLOWED_METHODS = 'allowed_methods';

public const ALLOWED_PROPERTIES = 'allowed_properties';

public const ALLOWED_TAGS = 'allowed_tags';

public const ALLOWED_METHODS_DEFAULT = ['*' => '*'];

/**
* @psalm-suppress UnusedVariable
*/
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder(self::TREE_NAME);
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/EmailTemplateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace BitBag\SyliusMailTemplatePlugin\Entity;

use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Model\TranslatableInterface;
use Sylius\Resource\Model\ResourceInterface;
use Sylius\Resource\Model\TranslatableInterface;

interface EmailTemplateInterface extends ResourceInterface, TranslatableInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/EmailTemplateTranslationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace BitBag\SyliusMailTemplatePlugin\Entity;

use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Model\TranslationInterface;
use Sylius\Resource\Model\ResourceInterface;

interface EmailTemplateTranslationInterface extends ResourceInterface, TranslationInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixture/Factory/EmailTemplateFixtureFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use BitBag\SyliusMailTemplatePlugin\Entity\EmailTemplateInterface;
use BitBag\SyliusMailTemplatePlugin\Entity\EmailTemplateTranslationInterface;
use BitBag\SyliusMailTemplatePlugin\Repository\EmailTemplateRepositoryInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Resource\Factory\FactoryInterface;

final class EmailTemplateFixtureFactory implements FixtureFactoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/MailPreviewData/Factory/CustomerPreviewDataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Faker\Generator;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Resource\Factory\FactoryInterface;

final class CustomerPreviewDataFactory implements PreviewDataFactoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/EmailTemplateRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace BitBag\SyliusMailTemplatePlugin\Repository;

use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Resource\Doctrine\Persistence\RepositoryInterface;

final class EmailTemplateRepository implements EmailTemplateRepositoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/EmailTemplateRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace BitBag\SyliusMailTemplatePlugin\Repository;

use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Resource\Doctrine\Persistence\RepositoryInterface;

interface EmailTemplateRepositoryInterface extends RepositoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/EmailTemplateTranslationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace BitBag\SyliusMailTemplatePlugin\Repository;

use BitBag\SyliusMailTemplatePlugin\Entity\EmailTemplateTranslationInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Resource\Doctrine\Persistence\RepositoryInterface;

final class EmailTemplateTranslationRepository implements EmailTemplateTranslationRepositoryInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace BitBag\SyliusMailTemplatePlugin\Repository;

use BitBag\SyliusMailTemplatePlugin\Entity\EmailTemplateTranslationInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Resource\Doctrine\Persistence\RepositoryInterface;

interface EmailTemplateTranslationRepositoryInterface extends RepositoryInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Repository/RepositoryDecoratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace BitBag\SyliusMailTemplatePlugin\Repository;

use Doctrine\ORM\QueryBuilder;
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Resource\Doctrine\Persistence\RepositoryInterface;
use Sylius\Resource\Model\ResourceInterface;

trait RepositoryDecoratorTrait
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
return [
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true],
];
7 changes: 7 additions & 0 deletions tests/Application/config/sylius/1.14/packages/_sylius.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
test_default_state_machine_adapter: 'symfony_workflow'
test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%'

sylius_state_machine_abstraction:
graphs_to_adapters_mapping:
sylius_refund_refund_payment: '%test_sylius_state_machine_adapter%'
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ security:
target: sylius_admin_login

new_api_admin_user:
pattern: "%sylius.security.new_api_admin_regex%/.*"
pattern: "%sylius.security.api_admin_regex%/.*"
provider: sylius_api_admin_user_provider
stateless: true
entry_point: jwt
json_login:
check_path: "%sylius.security.new_api_admin_route%/authentication-token"
check_path: "%sylius.security.api_admin_route%/administrators/token"
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
jwt: true

new_api_shop_user:
pattern: "%sylius.security.new_api_shop_regex%/.*"
pattern: "%sylius.security.api_shop_regex%/.*"
provider: sylius_api_shop_user_provider
stateless: true
entry_point: jwt
json_login:
check_path: "%sylius.security.new_api_shop_route%/authentication-token"
check_path: "%sylius.security.api_shop_route%/customers/token"
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
Expand Down Expand Up @@ -107,6 +107,7 @@ security:
- { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] }
- { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS }

- { path: "%sylius.security.admin_regex%/forgotten-password", role: PUBLIC_ACCESS }
- { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS }
- { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS }

Expand All @@ -116,9 +117,9 @@ security:
- { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS }
- { path: "%sylius.security.shop_regex%/account", role: ROLE_USER }

- { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS }
- { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS }
- { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS }
- { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER }
- { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS }
- { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS }
- { path: "%sylius.security.api_admin_route%/administrators/reset-password", role: PUBLIC_ACCESS }
- { path: "%sylius.security.api_admin_regex%/.*", role: ROLE_API_ACCESS }
- { path: "%sylius.security.api_admin_route%/administrators/token", role: PUBLIC_ACCESS }
- { path: "%sylius.security.api_shop_account_regex%/.*", role: ROLE_USER }
- { path: "%sylius.security.api_shop_route%/customers/token", role: PUBLIC_ACCESS }
- { path: "%sylius.security.api_shop_regex%/.*", role: PUBLIC_ACCESS }
2 changes: 1 addition & 1 deletion tests/Behat/Context/Setup/EmailTemplateContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use BitBag\SyliusMailTemplatePlugin\Entity\EmailTemplateTranslationInterface;
use BitBag\SyliusMailTemplatePlugin\Repository\EmailTemplateTranslationRepositoryInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Resource\Factory\FactoryInterface;

final class EmailTemplateContext implements Context
{
Expand Down
16 changes: 0 additions & 16 deletions tests/Behat/Context/Ui/EmailTemplateContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Behat\Behat\Context\Context;
use Sylius\Behat\Service\Checker\EmailCheckerInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Bundle\CoreBundle\SyliusCoreBundle;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\ShipmentInterface;
Expand Down Expand Up @@ -147,21 +146,6 @@ public function numberOfEmailsShouldBeSentTo(int $count, string $recipient): voi
Assert::same($this->emailChecker->countMessagesTo($recipient), $count);
}

/**
* @Then email(s) should be sent to :recipient depending on Sylius version
*/
public function numberOfEmailsShouldBeSentToDependingOnSyliusVersion(string $recipient): void
{
$count = 1;

/** @phpstan-ignore-next-line */
if (13 !== (int) SyliusCoreBundle::MINOR_VERSION) {
$count = 2;
}

Assert::same($this->emailChecker->countMessagesTo($recipient), $count);
}

/**
* @Then a welcoming email should have been sent to :recipient
* @Then a welcoming email should have been sent to :recipient in :localeCode locale
Expand Down