$offlineGatewayNames
+ */
public function __construct(
PaymentTokenProviderInterface $paymentTokenProvider,
ObjectManager $orderManager,
- OrderPaymentLinkSenderInterface $orderPaymentLinkSender
+ OrderPaymentLinkSenderInterface $orderPaymentLinkSender,
+ RequestStack $requestStack,
+ EventDispatcherInterface $eventDispatcher,
+ array $offlineGatewayNames,
+ bool $enabled,
) {
$this->paymentTokenProvider = $paymentTokenProvider;
$this->orderManager = $orderManager;
$this->orderPaymentLinkSender = $orderPaymentLinkSender;
+ $this->requestStack = $requestStack;
+ $this->eventDispatcher = $eventDispatcher;
+ $this->offlineGatewayNames = $offlineGatewayNames;
+ $this->enabled = $enabled;
}
public function setPaymentLink(GenericEvent $event): void
{
+ if (!$this->enabled) {
+ return;
+ }
+
/** @var OrderInterface $order */
$order = $event->getSubject();
Assert::isInstanceOf($order, OrderInterface::class);
@@ -51,14 +82,31 @@ public function setPaymentLink(GenericEvent $event): void
/** @var GatewayConfigInterface $gatewayConfig */
$gatewayConfig = $paymentMethod->getGatewayConfig();
- if ('offline' === $gatewayConfig->getGatewayName()) {
+ if (\in_array($gatewayConfig->getGatewayName(), $this->offlineGatewayNames, true)) {
return;
}
$token = $this->paymentTokenProvider->getPaymentToken($payment);
$payment->setDetails(['payment-link' => $token->getAfterUrl()]);
- $this->orderPaymentLinkSender->sendPaymentLink($order);
+ $this->eventDispatcher->dispatch(new PaymentLinkGeneratedEvent($payment));
+
+ if ($this->shouldSendPaymentLinkEmail()) {
+ $this->orderPaymentLinkSender->sendPaymentLink($order);
+ }
+
$this->orderManager->flush();
}
+
+ private function shouldSendPaymentLinkEmail(): bool
+ {
+ $request = $this->requestStack->getCurrentRequest();
+ if (null === $request) {
+ return false;
+ }
+
+ $formData = $request->request->all(NewOrderType::BLOCK_PREFIX);
+
+ return (bool) ($formData['sendPaymentLinkEmail'] ?? false);
+ }
}
diff --git a/src/Factory/OrderFactory.php b/src/Factory/OrderFactory.php
index db322eb31..21a6bac19 100644
--- a/src/Factory/OrderFactory.php
+++ b/src/Factory/OrderFactory.php
@@ -2,9 +2,8 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Factory;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Factory;
-use Sylius\AdminOrderCreationPlugin\ReorderProcessing\ReorderProcessor;
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\CustomerInterface;
@@ -13,6 +12,9 @@
use Sylius\Component\Currency\Model\CurrencyInterface;
use Sylius\Component\Locale\Model\LocaleInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Webgriffe\SyliusAdminOrderCreationPlugin\Event\OrderCreationInitializedEvent;
+use Webgriffe\SyliusAdminOrderCreationPlugin\ReorderProcessing\ReorderProcessor;
use Webmozart\Assert\Assert;
final class OrderFactory implements OrderFactoryInterface
@@ -29,17 +31,22 @@ final class OrderFactory implements OrderFactoryInterface
/** @var ReorderProcessor */
private $reorderProcessor;
+ /** @var EventDispatcherInterface */
+ private $eventDispatcher;
+
public function __construct(
FactoryInterface $baseOrderFactory,
CustomerRepositoryInterface $customerRepository,
ChannelRepositoryInterface $channelRepository,
- ReorderProcessor $reorderProcessor
+ ReorderProcessor $reorderProcessor,
+ EventDispatcherInterface $eventDispatcher,
) {
$this->baseOrderFactory = $baseOrderFactory;
$this->customerRepository = $customerRepository;
$this->channelRepository = $channelRepository;
$this->reorderProcessor = $reorderProcessor;
+ $this->eventDispatcher = $eventDispatcher;
}
public function createNew(): OrderInterface
@@ -77,6 +84,8 @@ public function createForCustomerAndChannel(string $customerId, string $channelC
Assert::isInstanceOf($defaultLocale, LocaleInterface::class);
$order->setLocaleCode($defaultLocale->getCode());
+ $this->eventDispatcher->dispatch(new OrderCreationInitializedEvent($order));
+
return $order;
}
@@ -87,6 +96,8 @@ public function createFromExistingOrder(OrderInterface $order): OrderInterface
$this->reorderProcessor->process($order, $reorder);
+ $this->eventDispatcher->dispatch(new OrderCreationInitializedEvent($reorder));
+
return $reorder;
}
}
diff --git a/src/Factory/OrderFactoryInterface.php b/src/Factory/OrderFactoryInterface.php
index 941553aec..09a95e655 100644
--- a/src/Factory/OrderFactoryInterface.php
+++ b/src/Factory/OrderFactoryInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Factory;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Factory;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
diff --git a/src/Form/Type/AdjustmentType.php b/src/Form/Type/AdjustmentType.php
index cfd89dcc1..1025ee20d 100644
--- a/src/Form/Type/AdjustmentType.php
+++ b/src/Form/Type/AdjustmentType.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\MoneyBundle\Form\Type\MoneyType;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
@@ -23,6 +23,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$builder->add('amount', MoneyType::class, [
'label' => $options['label'],
'currency' => $options['currency'],
+ 'empty_data' => 0,
'constraints' => [
new Range(['min' => 0, 'minMessage' => 'sylius_admin_order_creation.order_discount', 'groups' => ['sylius']]),
],
diff --git a/src/Form/Type/CurrencyCodeChoiceType.php b/src/Form/Type/CurrencyCodeChoiceType.php
index 5a747dc53..d8539f7d3 100644
--- a/src/Form/Type/CurrencyCodeChoiceType.php
+++ b/src/Form/Type/CurrencyCodeChoiceType.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\CurrencyBundle\Form\Type\CurrencyChoiceType;
use Sylius\Bundle\ResourceBundle\Form\DataTransformer\ResourceToIdentifierTransformer;
@@ -24,7 +24,7 @@ public function __construct(RepositoryInterface $currencyRepository)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->addModelTransformer(
- new ReversedTransformer(new ResourceToIdentifierTransformer($this->currencyRepository, 'code'))
+ new ReversedTransformer(new ResourceToIdentifierTransformer($this->currencyRepository, 'code')),
);
}
diff --git a/src/Form/Type/CustomerAutocompleteChoiceType.php b/src/Form/Type/CustomerAutocompleteChoiceType.php
deleted file mode 100644
index 7069f9542..000000000
--- a/src/Form/Type/CustomerAutocompleteChoiceType.php
+++ /dev/null
@@ -1,49 +0,0 @@
-setDefaults([
- 'resource' => 'sylius.customer',
- 'choice_name' => 'email',
- 'choice_value' => 'id',
- 'label' => false,
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildView(FormView $view, FormInterface $form, array $options): void
- {
- $view->vars['remote_criteria_type'] = 'contains';
- $view->vars['remote_criteria_name'] = 'email';
- }
-
- /**
- * {@inheritdoc}
- */
- public function getBlockPrefix(): string
- {
- return 'sylius_customer_autocomplete_choice';
- }
-
- /**
- * {@inheritdoc}
- */
- public function getParent(): string
- {
- return ResourceAutocompleteChoiceType::class;
- }
-}
diff --git a/src/Form/Type/CustomerAutocompleteType.php b/src/Form/Type/CustomerAutocompleteType.php
new file mode 100644
index 000000000..51cc5f98e
--- /dev/null
+++ b/src/Form/Type/CustomerAutocompleteType.php
@@ -0,0 +1,40 @@
+setDefaults([
+ 'class' => $this->customerClass,
+ 'choice_label' => 'email',
+ 'searchable_fields' => ['email'],
+ ]);
+ }
+
+ public function getBlockPrefix(): string
+ {
+ return 'webgriffe_sylius_admin_order_creation_customer_autocomplete';
+ }
+
+ public function getParent(): string
+ {
+ return BaseEntityAutocompleteType::class;
+ }
+}
diff --git a/src/Form/Type/LocaleCodeChoiceType.php b/src/Form/Type/LocaleCodeChoiceType.php
index 92508246b..2f639c52a 100644
--- a/src/Form/Type/LocaleCodeChoiceType.php
+++ b/src/Form/Type/LocaleCodeChoiceType.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\LocaleBundle\Form\Type\LocaleChoiceType;
use Sylius\Bundle\ResourceBundle\Form\DataTransformer\ResourceToIdentifierTransformer;
@@ -22,7 +22,7 @@ public function __construct(RepositoryInterface $localeRepository)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
@@ -30,7 +30,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getParent(): string
{
@@ -38,7 +38,7 @@ public function getParent(): string
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getBlockPrefix(): string
{
diff --git a/src/Form/Type/NewOrderCustomerCreateType.php b/src/Form/Type/NewOrderCustomerCreateType.php
index 2dad4d11b..8314d83ca 100644
--- a/src/Form/Type/NewOrderCustomerCreateType.php
+++ b/src/Form/Type/NewOrderCustomerCreateType.php
@@ -2,12 +2,13 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\Validator\Constraints\NotBlank;
final class NewOrderCustomerCreateType extends AbstractType
{
@@ -15,10 +16,14 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('customerEmail', TextType::class, [
- 'label' => false,
+ 'label' => 'sylius_admin_order_creation.ui.new_customer_email',
+ 'required' => false,
+ 'constraints' => [
+ new NotBlank(message: 'sylius_admin_order_creation.customer_email'),
+ ],
])
->add('channel', ChannelChoiceType::class, [
- 'label' => false,
+ 'label' => 'sylius.ui.channel',
])
;
}
diff --git a/src/Form/Type/NewOrderCustomerSelectType.php b/src/Form/Type/NewOrderCustomerSelectType.php
index bd5e2f284..51833b03e 100644
--- a/src/Form/Type/NewOrderCustomerSelectType.php
+++ b/src/Form/Type/NewOrderCustomerSelectType.php
@@ -2,23 +2,27 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\Validator\Constraints\NotBlank;
final class NewOrderCustomerSelectType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
- ->add('customer', CustomerAutocompleteChoiceType::class, [
- 'multiple' => false,
- 'required' => true,
+ ->add('customer', CustomerAutocompleteType::class, [
+ 'label' => 'sylius.ui.customer',
+ 'required' => false,
+ 'constraints' => [
+ new NotBlank(message: 'sylius_admin_order_creation.no_customer_selected'),
+ ],
])
->add('channel', ChannelChoiceType::class, [
- 'label' => false,
+ 'label' => 'sylius.ui.channel',
])
;
}
diff --git a/src/Form/Type/NewOrderType.php b/src/Form/Type/NewOrderType.php
index 0ba3d954d..056a35f6c 100644
--- a/src/Form/Type/NewOrderType.php
+++ b/src/Form/Type/NewOrderType.php
@@ -2,20 +2,25 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\AddressingBundle\Form\Type\AddressType;
use Sylius\Bundle\PromotionBundle\Form\Type\PromotionCouponToCodeType;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\OrderInterface;
-use Symfony\Component\Form\Extension\Core\Type\CollectionType;
+use Sylius\Component\Shipping\Model\ShippingSubjectInterface;
+use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
+use Symfony\Component\OptionsResolver\OptionsResolver;
+use Symfony\UX\LiveComponent\Form\Type\LiveCollectionType;
final class NewOrderType extends AbstractResourceType
{
+ public const BLOCK_PREFIX = 'sylius_admin_order_creation_new_order';
+
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
@@ -31,15 +36,23 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'sylius.ui.billing_address',
'required' => false,
])
- ->add('payments', CollectionType::class, [
+ ->add('payments', LiveCollectionType::class, [
'entry_type' => PaymentType::class,
'label' => 'sylius.ui.payments',
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
])
- ->add('shipments', CollectionType::class, [
+ ->add('sendPaymentLinkEmail', CheckboxType::class, [
+ 'mapped' => false,
+ 'required' => false,
+ 'label' => 'sylius_admin_order_creation.ui.send_payment_link_email',
+ ])
+ ->add('shipments', LiveCollectionType::class, [
'entry_type' => ShipmentType::class,
+ 'entry_options' => [
+ 'subject' => $options['shipmentChoicesSubject'],
+ ],
'label' => 'sylius.ui.shipments',
'allow_add' => true,
'allow_delete' => true,
@@ -55,17 +68,18 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$event
->getForm()
- ->add('items', CollectionType::class, [
+ ->add('items', LiveCollectionType::class, [
'label' => false,
'entry_type' => OrderItemType::class,
'entry_options' => [
'currency' => $order->getCurrencyCode(),
+ 'channelCode' => $channel->getCode(),
],
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
])
- ->add('adjustments', CollectionType::class, [
+ ->add('adjustments', LiveCollectionType::class, [
'label' => false,
'entry_type' => AdjustmentType::class,
'entry_options' => [
@@ -76,15 +90,17 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
- 'button_add_label' => 'sylius_admin_order_creation.ui.add_discount',
+ 'button_add_options' => [
+ 'label' => 'sylius_admin_order_creation.ui.add_discount',
+ ],
])
->add('localeCode', LocaleCodeChoiceType::class, [
- 'label' => false,
+ 'label' => 'sylius.ui.locale',
'choices' => $channel->getLocales(),
'empty_data' => $order->getLocaleCode(),
])
->add('currencyCode', CurrencyCodeChoiceType::class, [
- 'label' => false,
+ 'label' => 'sylius.ui.currency',
'choices' => $channel->getCurrencies(),
'empty_data' => $order->getCurrencyCode(),
])
@@ -93,7 +109,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event): void {
$orderData = $event->getData();
- if (isset($orderData['shippingAddress']) && $this->isBillingAddressEmpty($orderData)) {
+ if ($this->isShippingAddressComplete($orderData) && $this->isBillingAddressEmpty($orderData)) {
$orderData['billingAddress'] = $orderData['shippingAddress'];
$event->setData($orderData);
@@ -102,9 +118,17 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
;
}
+ public function configureOptions(OptionsResolver $resolver): void
+ {
+ parent::configureOptions($resolver);
+
+ $resolver->setDefault('shipmentChoicesSubject', null);
+ $resolver->setAllowedTypes('shipmentChoicesSubject', ['null', ShippingSubjectInterface::class]);
+ }
+
public function getBlockPrefix(): string
{
- return 'sylius_admin_order_creation_new_order';
+ return self::BLOCK_PREFIX;
}
private function isBillingAddressEmpty(array $orderData): bool
@@ -122,4 +146,26 @@ private function isBillingAddressEmpty(array $orderData): bool
$orderData['billingAddress']['postcode'] === ''
;
}
+
+ /**
+ * The order creation page re-renders live as the admin types (via the order-form Live Component), so
+ * this form's PRE_SUBMIT listener runs on every keystroke-triggered re-render, not just on the final
+ * submit. Only copying the shipping address into an empty billing address once shipping is itself
+ * fully filled in prevents a half-typed shipping address from being copied over field-by-field, which
+ * would otherwise permanently block the rest of the copy (billing would no longer read as "empty").
+ */
+ private function isShippingAddressComplete(array $orderData): bool
+ {
+ if (!isset($orderData['shippingAddress'])) {
+ return false;
+ }
+
+ foreach (['firstName', 'lastName', 'street', 'countryCode', 'city', 'postcode'] as $field) {
+ if (($orderData['shippingAddress'][$field] ?? '') === '') {
+ return false;
+ }
+ }
+
+ return true;
+ }
}
diff --git a/src/Form/Type/OrderItemType.php b/src/Form/Type/OrderItemType.php
index 74e1125e9..d320df377 100644
--- a/src/Form/Type/OrderItemType.php
+++ b/src/Form/Type/OrderItemType.php
@@ -2,17 +2,16 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
-use Sylius\Bundle\ResourceBundle\Form\Type\ResourceAutocompleteChoiceType;
use Symfony\Component\Form\DataMapperInterface;
-use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
+use Symfony\UX\LiveComponent\Form\Type\LiveCollectionType;
final class OrderItemType extends AbstractResourceType
{
@@ -22,7 +21,7 @@ final class OrderItemType extends AbstractResourceType
public function __construct(
string $dataClass,
DataMapperInterface $dataMapper,
- array $validationGroups = []
+ array $validationGroups = [],
) {
parent::__construct($dataClass, $validationGroups);
@@ -37,16 +36,17 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'sylius.ui.quantity',
'empty_data' => 1,
])
- ->add('variant', ResourceAutocompleteChoiceType::class, [
+ ->add('variant', ProductVariantInChannelAutocompleteType::class, [
'label' => 'sylius.ui.variant',
- 'choice_name' => 'descriptor',
- 'choice_value' => 'code',
- 'resource' => 'sylius.product_variant',
+ 'extra_options' => [
+ 'channel_code' => $options['channelCode'],
+ 'choice_label' => 'descriptor',
+ ],
])
->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($options): void {
$event
->getForm()
- ->add('adjustments', CollectionType::class, [
+ ->add('adjustments', LiveCollectionType::class, [
'label' => false,
'entry_type' => AdjustmentType::class,
'entry_options' => [
@@ -57,7 +57,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
- 'button_add_label' => 'sylius_admin_order_creation.ui.add_discount',
+ 'button_add_options' => [
+ 'label' => 'sylius_admin_order_creation.ui.add_discount',
+ ],
])
;
})
@@ -78,10 +80,11 @@ public function configureOptions(OptionsResolver $resolver): void
parent::configureOptions($resolver);
$resolver->setRequired('currency');
+ $resolver->setRequired('channelCode');
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getBlockPrefix(): string
{
diff --git a/src/Form/Type/PaymentType.php b/src/Form/Type/PaymentType.php
index 8402a63ab..ef174db4e 100644
--- a/src/Form/Type/PaymentType.php
+++ b/src/Form/Type/PaymentType.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\PaymentBundle\Form\Type\PaymentMethodChoiceType;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
@@ -19,7 +19,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getBlockPrefix(): string
{
diff --git a/src/Form/Type/ProductVariantInChannelAutocompleteType.php b/src/Form/Type/ProductVariantInChannelAutocompleteType.php
new file mode 100644
index 000000000..73e2380df
--- /dev/null
+++ b/src/Form/Type/ProductVariantInChannelAutocompleteType.php
@@ -0,0 +1,56 @@
+setDefaults([
+ 'class' => $this->productVariantClass,
+ 'filter_query' => function (Options $options): ?callable {
+ $channelCode = $options['extra_options']['channel_code'] ?? null;
+
+ if ($channelCode === null) {
+ return null;
+ }
+
+ return function (QueryBuilder $queryBuilder, string $query, EntityRepository $repository) use ($channelCode): void {
+ $queryBuilder
+ ->innerJoin('entity.channelPricings', 'channelPricing')
+ ->andWhere('channelPricing.channelCode = :channelPricingChannelCode')
+ ->setParameter('channelPricingChannelCode', $channelCode)
+ ;
+ };
+ },
+ ]);
+ }
+
+ public function getBlockPrefix(): string
+ {
+ return 'webgriffe_sylius_admin_order_creation_product_variant_in_channel_autocomplete';
+ }
+
+ public function getParent(): string
+ {
+ return TranslatableAutocompleteType::class;
+ }
+}
diff --git a/src/Form/Type/ShipmentType.php b/src/Form/Type/ShipmentType.php
index 60ffecc9f..a141270d3 100644
--- a/src/Form/Type/ShipmentType.php
+++ b/src/Form/Type/ShipmentType.php
@@ -2,24 +2,40 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Form\Type;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Form\Type;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodChoiceType;
+use Sylius\Component\Shipping\Model\ShippingSubjectInterface;
use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolver;
final class ShipmentType extends AbstractResourceType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
- $builder->add('method', ShippingMethodChoiceType::class, [
+ $methodOptions = [
'required' => true,
'label' => 'sylius.form.checkout.shipping_method',
- ]);
+ ];
+
+ if ($options['subject'] !== null) {
+ $methodOptions['subject'] = $options['subject'];
+ }
+
+ $builder->add('method', ShippingMethodChoiceType::class, $methodOptions);
+ }
+
+ public function configureOptions(OptionsResolver $resolver): void
+ {
+ parent::configureOptions($resolver);
+
+ $resolver->setDefault('subject', null);
+ $resolver->setAllowedTypes('subject', ['null', ShippingSubjectInterface::class]);
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getBlockPrefix(): string
{
diff --git a/src/Preparator/NewOrderPreparator.php b/src/Preparator/NewOrderPreparator.php
deleted file mode 100644
index a5dc7f759..000000000
--- a/src/Preparator/NewOrderPreparator.php
+++ /dev/null
@@ -1,53 +0,0 @@
-orderFactory = $orderFactory;
- $this->formFactory = $formFactory;
- $this->orderProcessor = $orderProcessor;
- }
-
- public function prepareFromRequest(Request $request): OrderInterface
- {
- Assert::true($request->attributes->has('customerId'));
- $customerEmail = $request->attributes->get('customerId');
-
- Assert::true($request->attributes->has('channelCode'));
- $channelCode = $request->attributes->get('channelCode');
-
- $order = $this->orderFactory->createForCustomerAndChannel($customerEmail, $channelCode);
- $form = $this->formFactory->create(NewOrderType::class, $order);
-
- /** @var OrderInterface $order */
- $order = $form->handleRequest($request)->getData();
- $this->orderProcessor->process($order);
-
- return $order;
- }
-}
diff --git a/src/Preparator/OrderPreparatorInterface.php b/src/Preparator/OrderPreparatorInterface.php
deleted file mode 100644
index c17884746..000000000
--- a/src/Preparator/OrderPreparatorInterface.php
+++ /dev/null
@@ -1,13 +0,0 @@
-shippingMethodsResolver = $shippingMethodsResolver;
- }
-
- public function __invoke(ShipmentInterface $shipment): array
- {
- $shippingMethods = $this->shippingMethodsResolver->getSupportedMethods($shipment);
- $shippingMethodsList = [];
-
- foreach ($shippingMethods as $shippingMethod) {
- $shippingMethodsList[$shippingMethod->getCode()] = $shippingMethod->getName();
- }
-
- return $shippingMethodsList;
- }
-}
diff --git a/src/Provider/CustomerProvider.php b/src/Provider/CustomerProvider.php
index 3f7fc93b3..8e288e674 100644
--- a/src/Provider/CustomerProvider.php
+++ b/src/Provider/CustomerProvider.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Provider;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Provider;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Repository\CustomerRepositoryInterface;
@@ -19,7 +19,7 @@ final class CustomerProvider implements CustomerProviderInterface
public function __construct(
CustomerRepositoryInterface $customerRepository,
- FactoryInterface $customerFactory
+ FactoryInterface $customerFactory,
) {
$this->customerRepository = $customerRepository;
$this->customerFactory = $customerFactory;
diff --git a/src/Provider/CustomerProviderInterface.php b/src/Provider/CustomerProviderInterface.php
index 998a5f262..0d51c4239 100644
--- a/src/Provider/CustomerProviderInterface.php
+++ b/src/Provider/CustomerProviderInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Provider;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Provider;
use Sylius\Component\Core\Model\CustomerInterface;
diff --git a/src/Provider/PaymentTokenProvider.php b/src/Provider/PaymentTokenProvider.php
index 21d0fd4a0..20cc7b8c4 100644
--- a/src/Provider/PaymentTokenProvider.php
+++ b/src/Provider/PaymentTokenProvider.php
@@ -2,13 +2,13 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Provider;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Provider;
-use Payum\Core\Model\GatewayConfigInterface;
use Payum\Core\Payum;
use Payum\Core\Security\TokenInterface;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\Model\PaymentMethodInterface;
+use Sylius\Component\Payment\Model\GatewayConfigInterface;
final class PaymentTokenProvider implements PaymentTokenProviderInterface
{
@@ -40,14 +40,14 @@ public function getPaymentToken(PaymentInterface $payment): TokenInterface
return $tokenFactory->createAuthorizeToken(
$gatewayConfig->getGatewayName(),
$payment,
- $this->afterPayRoute
+ $this->afterPayRoute,
);
}
return $tokenFactory->createCaptureToken(
$gatewayConfig->getGatewayName(),
$payment,
- $this->afterPayRoute
+ $this->afterPayRoute,
);
}
}
diff --git a/src/Provider/PaymentTokenProviderInterface.php b/src/Provider/PaymentTokenProviderInterface.php
index 342051a28..28789cd69 100644
--- a/src/Provider/PaymentTokenProviderInterface.php
+++ b/src/Provider/PaymentTokenProviderInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Provider;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Provider;
use Payum\Core\Security\TokenInterface;
use Sylius\Component\Core\Model\PaymentInterface;
diff --git a/src/ReorderProcessing/CompositeReorderProcessor.php b/src/ReorderProcessing/CompositeReorderProcessor.php
index 2ebf7f8ff..7906cf6ab 100644
--- a/src/ReorderProcessing/CompositeReorderProcessor.php
+++ b/src/ReorderProcessing/CompositeReorderProcessor.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\ReorderProcessing;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\ReorderProcessing;
-use Sylius\Component\Core\Model\OrderInterface;
use Laminas\Stdlib\PriorityQueue;
+use Sylius\Component\Core\Model\OrderInterface;
final class CompositeReorderProcessor implements ReorderProcessor
{
diff --git a/src/ReorderProcessing/ReorderDataProcessor.php b/src/ReorderProcessing/ReorderDataProcessor.php
index ce39f7d17..177873904 100644
--- a/src/ReorderProcessing/ReorderDataProcessor.php
+++ b/src/ReorderProcessing/ReorderDataProcessor.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\ReorderProcessing;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\ReorderProcessing;
use Sylius\Component\Core\Model\AddressInterface;
use Sylius\Component\Core\Model\OrderInterface;
diff --git a/src/ReorderProcessing/ReorderItemsProcessor.php b/src/ReorderProcessing/ReorderItemsProcessor.php
index 3304745ec..efa67fbd2 100644
--- a/src/ReorderProcessing/ReorderItemsProcessor.php
+++ b/src/ReorderProcessing/ReorderItemsProcessor.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\ReorderProcessing;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\ReorderProcessing;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\OrderItemInterface;
@@ -25,7 +25,7 @@ final class ReorderItemsProcessor implements ReorderProcessor
public function __construct(
FactoryInterface $orderItemFactory,
OrderItemQuantityModifierInterface $orderItemQuantityModifier,
- OrderModifierInterface $orderModifier
+ OrderModifierInterface $orderModifier,
) {
$this->orderItemFactory = $orderItemFactory;
$this->orderItemQuantityModifier = $orderItemQuantityModifier;
diff --git a/src/ReorderProcessing/ReorderPaymentProcessor.php b/src/ReorderProcessing/ReorderPaymentProcessor.php
index 3db804fc0..aca978425 100644
--- a/src/ReorderProcessing/ReorderPaymentProcessor.php
+++ b/src/ReorderProcessing/ReorderPaymentProcessor.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\ReorderProcessing;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\ReorderProcessing;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
diff --git a/src/ReorderProcessing/ReorderProcessor.php b/src/ReorderProcessing/ReorderProcessor.php
index 172f5685c..229064e39 100644
--- a/src/ReorderProcessing/ReorderProcessor.php
+++ b/src/ReorderProcessing/ReorderProcessor.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\ReorderProcessing;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\ReorderProcessing;
use Sylius\Component\Core\Model\OrderInterface;
diff --git a/src/ReorderProcessing/ReorderShipmentProcessor.php b/src/ReorderProcessing/ReorderShipmentProcessor.php
index 42935195c..906a7d93f 100644
--- a/src/ReorderProcessing/ReorderShipmentProcessor.php
+++ b/src/ReorderProcessing/ReorderShipmentProcessor.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\ReorderProcessing;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\ReorderProcessing;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\ShipmentInterface;
diff --git a/src/Resources/config/app/ajax.yml b/src/Resources/config/app/ajax.yml
deleted file mode 100644
index 22c3e21cb..000000000
--- a/src/Resources/config/app/ajax.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-sylius_admin_order_creation_ajax_customer:
- path: /customer-search
- methods: [GET]
- defaults:
- _controller: sylius.controller.customer:indexAction
- _format: json
- _sylius:
- permission: true
- repository:
- method: findByEmailPart
- arguments: $email
-
-sylius_admin_order_creation_ajax_customer_by_email:
- path: /customer-search-by-email
- methods: [GET]
- defaults:
- _controller: sylius.controller.customer:indexAction
- _format: json
- _sylius:
- permission: true
- repository:
- method: findBy
- arguments: [email: $email]
-
-sylius_admin_order_creation_ajax_product_variants_by_phrase_and_channel:
- path: /product-variant-search/{channelCode}
- methods: [GET]
- defaults:
- _controller: sylius.controller.product_variant:indexAction
- _format: json
- _sylius:
- permission: true
- serialization_groups: [Autocomplete]
- repository:
- method: findByPhraseAndChannelCode
- arguments:
- phrase: $phrase
- channelCode: $channelCode
- locale: expr:service('sylius.context.locale').getLocaleCode()
-
-sylius_admin_order_creation_ajax_product_variant_by_codes:
- path: /product-variant-search-by-code
- methods: [GET]
- defaults:
- _controller: sylius.controller.product_variant:indexAction
- _format: json
- _sylius:
- permission: true
- serialization_groups: [Autocomplete]
- repository:
- method: findOneByCode
- arguments: $code
-
-sylius_admin_order_creation_ajax_provide_available_shipping_methods:
- path: /admin/orders/available-shipping-methods/{customerId}/{channelCode}/{shipmentNumber}
- methods: [GET]
- defaults:
- _controller: Sylius\AdminOrderCreationPlugin\Controller\ProvideAvailableShippingMethodsAction
- options:
- expose: true
diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml
deleted file mode 100644
index 5e3f1bce4..000000000
--- a/src/Resources/config/services.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %sylius.model.order.class%
- %sylius.form.type.order.validation_groups%
-
-
-
- %sylius.model.order_item.class%
-
- %sylius.form.type.order_item.validation_groups%
-
-
-
- %sylius.model.shipment.class%
- %sylius.form.type.shipment.validation_groups%
-
-
-
- %sylius.model.payment.class%
- %sylius.form.type.payment.validation_groups%
-
-
-
- %sylius.model.adjustment.class%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- sylius_shop_order_after_pay
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Resources/views/Order/Create/_breadcrumb.html.twig b/src/Resources/views/Order/Create/_breadcrumb.html.twig
deleted file mode 100644
index c2e087795..000000000
--- a/src/Resources/views/Order/Create/_breadcrumb.html.twig
+++ /dev/null
@@ -1,10 +0,0 @@
-{% import '@SyliusAdmin/Macro/breadcrumb.html.twig' as breadcrumb %}
-
-{% set breadcrumbs = [
- { label: 'sylius.ui.administration'|trans, url: path('sylius_admin_dashboard') },
- { label: 'sylius.ui.orders'|trans, url: path('sylius_admin_order_index') },
- { label: 'sylius.ui.new'|trans }
-]
-%}
-
-{{ breadcrumb.crumble(breadcrumbs) }}
diff --git a/src/Resources/views/Order/Create/_form.html.twig b/src/Resources/views/Order/Create/_form.html.twig
deleted file mode 100644
index 82515cbb9..000000000
--- a/src/Resources/views/Order/Create/_form.html.twig
+++ /dev/null
@@ -1,52 +0,0 @@
-
- {{ form_start(form, {'action': action, 'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate'}}) }}
-
-
-
- {{ 'sylius.ui.items'|trans }}
-
-
- {{ form_row(form.items) }}
-
-
-
- {{ 'sylius.ui.shipping_address'|trans }} & {{ 'sylius.ui.billing_address'|trans }}
-
-
-
-
{{ form_row(form.shippingAddress) }}
-
{{ form_row(form.billingAddress) }}
-
-
-
-
- {{ 'sylius.ui.locale'|trans }} & {{ 'sylius.ui.currency'|trans }}
-
-
-
-
{{ form_row(form.localeCode) }}
-
{{ form_row(form.currencyCode) }}
-
-
-
-
- {{ 'sylius.ui.shipments'|trans }} & {{ 'sylius.ui.payments'|trans }}
-
-
-
-
-
{{ 'sylius_admin_order_creation.ui.shipping_methods_selection_requirement'|trans }}
- {{ form_row(form.shipments) }}
-
-
- {{ form_row(form.payments) }}
-
-
-
-
-
- {% include '@SyliusUi/Form/Buttons/_create.html.twig' with {'paths': {'cancel': path('sylius_admin_order_index')}} %}
-
- {{ form_row(form._token) }}
- {{ form_end(form, {'render_rest': false}) }}
-
diff --git a/src/Resources/views/Order/Show/_item.html.twig b/src/Resources/views/Order/Show/_item.html.twig
deleted file mode 100644
index b1e5cd819..000000000
--- a/src/Resources/views/Order/Show/_item.html.twig
+++ /dev/null
@@ -1,43 +0,0 @@
-{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %}
-
-{% set orderPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT') %}
-{% set itemPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT') %}
-{% set orderItemDiscountAdjustment = constant('Sylius\\AdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_ITEM_DISCOUNT_ADJUSTMENT') %}
-{% set shippingAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::SHIPPING_ADJUSTMENT') %}
-{% set taxAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::TAX_ADJUSTMENT') %}
-
-{% set variant = item.variant %}
-{% set product = variant.product %}
-
-
-
- {% include '@SyliusAdmin/Product/_info.html.twig' %}
-
-
- {{ money.format(item.unitPrice, order.currencyCode) }}
-
-
- {{ money.format(item.discountedUnitPrice, order.currencyCode) }}
-
-
- {{ item.quantity }}
-
-
- {{ money.format(item.subtotal, order.currencyCode) }}
-
-
- {% set itemDiscountTotal = item.getAdjustmentsTotalRecursively(orderPromotionAdjustment) + item.getAdjustmentsTotalRecursively(orderItemDiscountAdjustment) %}
- {{ money.format(itemDiscountTotal, order.currencyCode) }}
-
-
- {{ money.format(item.taxTotal, order.currencyCode) }}
-
-
- {{ money.format(item.total, order.currencyCode) }}
-
-
-
-
- {{ form_row(form.adjustments) }}
-
-
diff --git a/src/Resources/views/Order/Show/_summary.html.twig b/src/Resources/views/Order/Show/_summary.html.twig
deleted file mode 100644
index cbcfcea4f..000000000
--- a/src/Resources/views/Order/Show/_summary.html.twig
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
- {{ 'sylius.ui.order_item_product'|trans }}
- {{ 'sylius.ui.unit_price'|trans }}
- {{ 'sylius.ui.item_discount'|trans }}
- {{ 'sylius.ui.distributed_order_discount'|trans }}
- {{ 'sylius.ui.discounted_unit_price'|trans }}
- {{ 'sylius.ui.quantity'|trans }}
- {{ 'sylius.ui.subtotal'|trans }}
- {{ 'sylius.ui.tax'|trans }}
- {{ 'sylius.ui.total'|trans }}
-
-
-
- {% for item_form in form.children %}
- {% include '@SyliusAdmin/Order/Show/Summary/_item.html.twig' with {'item': order.items.get(loop.index0)} %}
-
-
-
- {{ form_row(item_form.adjustments) }}
-
-
- {% endfor %}
-
-
- {% include '@SyliusAdmin/Order/Show/Summary/_totals.html.twig' %}
-
-
diff --git a/src/Resources/views/Order/create.html.twig b/src/Resources/views/Order/create.html.twig
deleted file mode 100644
index 02275723c..000000000
--- a/src/Resources/views/Order/create.html.twig
+++ /dev/null
@@ -1,109 +0,0 @@
-{% extends '@SyliusAdmin/layout.html.twig' %}
-
-{% block title %}{{ 'sylius.ui.new_order'|trans }} {{ parent() }}{% endblock %}
-
-{% form_theme form '@SyliusAdminOrderCreationPlugin/Order/itemCollectionTheme.html.twig' %}
-
-{% if order is defined %}
- {% set customer_id = order.customer.id %}
- {% set channel_code = order.channel.code %}
-{% else %}
- {% set customer_id = app.request.attributes.get('customerId') %}
- {% set channel_code = app.request.attributes.get('channelCode') %}
-{% endif %}
-
-{% block content %}
-
-
-
- {% include '@SyliusAdminOrderCreationPlugin/Order/Create/_breadcrumb.html.twig' %}
-
-
- {% include '@SyliusAdminOrderCreationPlugin/Order/Create/_form.html.twig' with {
- 'action': path('sylius_admin_order_creation_order_preview', {'customerId': customer_id, 'channelCode': channel_code})
- } %}
-{% endblock %}
-
-{% block javascripts %}
- {{ parent() }}
-
-
-
-{% endblock %}
diff --git a/src/Resources/views/Order/itemCollectionTheme.html.twig b/src/Resources/views/Order/itemCollectionTheme.html.twig
deleted file mode 100644
index f2dc5e303..000000000
--- a/src/Resources/views/Order/itemCollectionTheme.html.twig
+++ /dev/null
@@ -1,15 +0,0 @@
-{% extends '@SyliusAdmin/Form/theme.html.twig' %}
-
-{% block _sylius_admin_order_creation_new_order_items_entry_widget %}
- {% spaceless %}
-
- {{ form_row(form.quantity, {'attr': {'class' : 'item-quantity'}}) }}
- {{ form_row(form.variant, {
- 'remote_url': path('sylius_admin_order_creation_ajax_product_variants_by_phrase_and_channel', {'channelCode': form.parent.parent.vars.value.channel.code}),
- 'remote_criteria_type': 'contains',
- 'remote_criteria_name': 'phrase',
- 'load_edit_url': path('sylius_admin_order_creation_ajax_product_variant_by_codes')
- }) }}
-
- {% endspaceless %}
-{% endblock %}
diff --git a/src/Resources/views/Order/preview.html.twig b/src/Resources/views/Order/preview.html.twig
deleted file mode 100644
index dc76941a3..000000000
--- a/src/Resources/views/Order/preview.html.twig
+++ /dev/null
@@ -1,175 +0,0 @@
-{% extends '@SyliusAdmin/layout.html.twig' %}
-
-{% import '@SyliusUi/Macro/flags.html.twig' as flags %}
-
-{% block title %}{{ 'sylius_admin_order_creation.ui.order_preview'|trans }}{% endblock %}
-
-{% form_theme form '@SyliusAdminOrderCreationPlugin/Order/itemCollectionTheme.html.twig' %}
-
-{% block content %}
- {% set order = form.vars.data %}
-
- {{ form_start(form, {
- 'attr': {'novalidate': 'novalidate', 'id': form.vars.id },
- 'method': 'POST'
- }) }}
-
-
-
- {{ form_errors(form) }}
-
-
-
-
-
- {% include '@SyliusAdminOrderCreationPlugin/Order/Show/_summary.html.twig' with {'form': form.items} %}
-
-
-
-
-
-
-
- {{ 'sylius.ui.customer_since'|trans }} {{ order.customer.createdAt|format_date }}.
-
-
-
- {% if order.customer.phoneNumber is not empty %}
-
- {% endif %}
- {% if order.customerIp is defined and order.customerIp is not empty %}
-
- {% endif %}
-
-
-
- {% include '@SyliusAdmin/Common/_address.html.twig' with {'address': order.shippingAddress} %}
-
-
-
- {% include '@SyliusAdmin/Common/_address.html.twig' with {'address': order.billingAddress} %}
-
-
-
-
-
-
-
- {{ form_row(form.promotionCoupon) }}
- {{ form_row(form.shippingAddress) }}
- {{ form_row(form.billingAddress) }}
- {{ form_row(form.payments) }}
- {{ form_row(form.shipments) }}
-
- {{ form_row(form.adjustments) }}
-
-
-
-
-
-
- {% if order.hasPayments %}
-
-
- {% for payment in order.payments %}
- {% include '@SyliusAdmin/Order/Show/_payment.html.twig' %}
- {% endfor %}
-
- {% endif %}
-
-
-
-
- {% if order.hasShipments %}
-
-
- {% for shipment in order.shipments %}
- {% include '@SyliusAdmin/Order/Show/_shipment.html.twig' %}
- {% endfor %}
-
- {% endif %}
-
-
-
-
- {{ form_rest(form) }}
-
- {{ form_end(form) }}
-
-
-
-
-
- {{ 'sylius.ui.back'|trans }}
-
-
- {{ 'sylius_admin_order_creation.ui.confirm'|trans }}
-
-
-{% endblock %}
-
-{% block javascripts %}
- {{ parent() }}
-
-{% endblock %}
diff --git a/src/Resources/views/Order/selectCustomer.html.twig b/src/Resources/views/Order/selectCustomer.html.twig
deleted file mode 100644
index 3cda40f3a..000000000
--- a/src/Resources/views/Order/selectCustomer.html.twig
+++ /dev/null
@@ -1,107 +0,0 @@
-{% extends '@SyliusAdmin/layout.html.twig' %}
-
-{% form_theme selectCustomerForm '@SyliusAdminOrderCreationPlugin/Order/selectCustomerTheme.html.twig' %}
-{% form_theme createCustomerForm '@SyliusAdmin/Form/theme.html.twig' %}
-
-{% block pre_content %}
-
-{% endblock %}
-
-{% block content %}
-
- {{ form_start(selectCustomerForm, {'method': 'GET'})}}
- {{ form_row(selectCustomerForm.customer) }}
- {{ form_row(selectCustomerForm.channel, {'attr': {'class': 'ui fluid selection dropdown'}}) }}
- {{ 'sylius.ui.next'|trans }}
- {{ form_end(selectCustomerForm) }}
-
-
- {{ 'sylius.ui.or'|trans }}
-
-
-
- {{ form_start(createCustomerForm, {'method': 'GET'})}}
-
- {{ form_widget(createCustomerForm.customerEmail, {'attr': {'placeholder': 'sylius_admin_order_creation.ui.new_customer_email'|trans}}) }}
-
- {{ form_row(createCustomerForm.channel, {'attr': {'class': 'ui fluid selection dropdown'}}) }}
-
- {{ 'sylius_admin_order_creation.ui.create_new'|trans }}
-
- {{ form_end(createCustomerForm) }}
-
-{% endblock %}
-
-{% block javascripts %}
- {{ parent() }}
-
-
-
-
-{% endblock %}
diff --git a/src/Resources/views/Order/selectCustomerTheme.html.twig b/src/Resources/views/Order/selectCustomerTheme.html.twig
deleted file mode 100644
index 44b7b6d30..000000000
--- a/src/Resources/views/Order/selectCustomerTheme.html.twig
+++ /dev/null
@@ -1,8 +0,0 @@
-{% extends '@SyliusAdmin/Form/theme.html.twig' %}
-
-{% block sylius_customer_autocomplete_choice_row %}
- {{ form_row(form, {
- 'remote_url': path('sylius_admin_order_creation_ajax_customer'),
- 'load_edit_url': path('sylius_admin_order_creation_ajax_customer_by_email')
- }) }}
-{% endblock %}
diff --git a/src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_item.html.twig b/src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_item.html.twig
deleted file mode 100644
index fe177a554..000000000
--- a/src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_item.html.twig
+++ /dev/null
@@ -1,52 +0,0 @@
-{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %}
-
-{% set orderPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT') %}
-{% set unitPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT') %}
-{% set shippingAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::SHIPPING_ADJUSTMENT') %}
-{% set taxAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::TAX_ADJUSTMENT') %}
-{% set orderItemDiscountAdjustment = constant('Sylius\\AdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_ITEM_DISCOUNT_ADJUSTMENT') %}
-
-{% set variant = item.variant %}
-{% set product = variant.product %}
-
-{% set unitDiscount = item.units.first.adjustmentsTotal(unitPromotionAdjustment) + item.getAdjustmentsTotalRecursively(orderItemDiscountAdjustment) / item.quantity %}
-{% set discountedUnitPrice = item.fullDiscountedUnitPrice + item.getAdjustmentsTotalRecursively(orderItemDiscountAdjustment) / item.quantity %}
-{% set subtotal = item.quantity * (item.unitPrice + item.units.first.adjustmentsTotal(unitPromotionAdjustment) + item.units.first.adjustmentsTotal(orderPromotionAdjustment)) + item.getAdjustmentsTotalRecursively(orderItemDiscountAdjustment) %}
-
-{% set taxIncluded = sylius_admin_order_unit_tax_included(item) %}
-{% set taxExcluded = sylius_admin_order_unit_tax_excluded(item) %}
-
-
-
- {% include '@SyliusAdmin/Product/_info.html.twig' %}
-
-
- {{ money.format(item.unitPrice, order.currencyCode) }}
-
-
- {{ money.format(unitDiscount, order.currencyCode) }}
-
-
- {{ money.format(item.units.first.adjustmentsTotal(orderPromotionAdjustment), order.currencyCode) }}
-
-
- {{ money.format(discountedUnitPrice, order.currencyCode) }}
-
-
- {{ item.quantity }}
-
-
- {{ money.format(subtotal, order.currencyCode) }}
-
-
- {{ money.format(taxExcluded, order.currencyCode) }}
-
-
{{ money.format(taxIncluded, order.currencyCode) }}
-
-
({{ 'sylius.ui.included_in_price'|trans }})
-
-
-
- {{ money.format(item.total, order.currencyCode) }}
-
-
diff --git a/src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig b/src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig
deleted file mode 100644
index ab2a43d97..000000000
--- a/src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig
+++ /dev/null
@@ -1,73 +0,0 @@
-{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %}
-
-{% set orderPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT') %}
-{% set orderShippingPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT') %}
-{% set itemPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT') %}
-{% set shippingAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::SHIPPING_ADJUSTMENT') %}
-{% set taxAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::TAX_ADJUSTMENT') %}
-{% set orderDiscountAdjustment = constant('Sylius\\AdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_DISCOUNT_ADJUSTMENT') %}
-
-{% set orderShippingPromotions = sylius_aggregate_adjustments(order.getAdjustmentsRecursively(orderShippingPromotionAdjustment)) %}
-
-
-
-
- {{ 'sylius.ui.tax_total'|trans }} :
- {{ money.format(order.taxTotal, order.currencyCode) }}
-
-
- {{ 'sylius.ui.items_total'|trans }} :
- {{ money.format(order.itemsTotal, order.currencyCode) }}
-
-
-
-
- {% if not order.adjustments(shippingAdjustment).isEmpty() %}
-
-
{{ 'sylius.ui.shipping'|trans }}:
- {% for adjustment in order.adjustments(shippingAdjustment) %}
-
-
{{ money.format(adjustment.amount, order.currencyCode) }}
-
-
- {{ adjustment.label }} :
-
-
-
- {% endfor %}
-
- {% else %}
- {{ 'sylius.ui.no_shipping_charges'|trans }}
- {% endif %}
-
- {% if not orderShippingPromotions is empty %}
-
-
-
{{ 'sylius.ui.shipping_discount'|trans }}:
- {% for label, amount in orderShippingPromotions %}
-
-
- {{ money.format(amount, order.currencyCode) }}
-
-
- {% endfor %}
-
-
- {% endif %}
-
- {{ 'sylius.ui.shipping_total'|trans }} :
- {{ money.format(order.shippingTotal, order.currencyCode) }}
-
-
-
-
- {{ 'sylius_admin_order_creation.ui.order_discount'|trans }} :
- {{ money.format(order.getAdjustmentsTotalRecursively(orderDiscountAdjustment), order.currencyCode) }}
-
-
-
-
-
diff --git a/src/Resources/views/SyliusAdminBundle/Order/Show/_payment.html.twig b/src/Resources/views/SyliusAdminBundle/Order/Show/_payment.html.twig
deleted file mode 100644
index 72e0eaa99..000000000
--- a/src/Resources/views/SyliusAdminBundle/Order/Show/_payment.html.twig
+++ /dev/null
@@ -1,44 +0,0 @@
-{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %}
-{% import '@SyliusUi/Macro/labels.html.twig' as label %}
-
-
-
- {% include '@SyliusAdmin/Common/Label/paymentState.html.twig' with {'data': payment.state} %}
-
-
-
-
-
- {{ money.format(payment.amount, payment.order.currencyCode) }}
-
-
- {% if sm_can(payment, 'complete', 'sylius_payment') %}
-
-
-
- {% if payment.details['payment-link'] is defined %}
-
- {% endif %}
- {% endif %}
- {% if sm_can(payment, 'refund', 'sylius_payment') %}
-
-
-
- {% endif %}
-
diff --git a/src/Sender/OrderPaymentLinkSender.php b/src/Sender/OrderPaymentLinkSender.php
index 51d1c63b0..f7459c022 100644
--- a/src/Sender/OrderPaymentLinkSender.php
+++ b/src/Sender/OrderPaymentLinkSender.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Sender;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Sender;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
@@ -39,7 +39,7 @@ public function sendPaymentLink(OrderInterface $order): void
[
'order' => $order,
'paymentLink' => $paymentDetails['payment-link'],
- ]
+ ],
)
;
}
diff --git a/src/Sender/OrderPaymentLinkSenderInterface.php b/src/Sender/OrderPaymentLinkSenderInterface.php
index 359e9c109..680b7002f 100644
--- a/src/Sender/OrderPaymentLinkSenderInterface.php
+++ b/src/Sender/OrderPaymentLinkSenderInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Sylius\AdminOrderCreationPlugin\Sender;
+namespace Webgriffe\SyliusAdminOrderCreationPlugin\Sender;
use Sylius\Component\Core\Model\OrderInterface;
diff --git a/src/SyliusAdminOrderCreationPlugin.php b/src/SyliusAdminOrderCreationPlugin.php
deleted file mode 100644
index 48973d09f..000000000
--- a/src/SyliusAdminOrderCreationPlugin.php
+++ /dev/null
@@ -1,20 +0,0 @@
-addCompilerPass(new RegisterReorderProcessorsPass());
- }
-}
diff --git a/src/Twig/Component/OrderFormComponent.php b/src/Twig/Component/OrderFormComponent.php
new file mode 100644
index 000000000..163799f1c
--- /dev/null
+++ b/src/Twig/Component/OrderFormComponent.php
@@ -0,0 +1,124 @@
+formFactory->create(NewOrderType::class, $this->createOrder(), [
+ 'shipmentChoicesSubject' => $this->computeShipmentChoicesSubject(),
+ ]);
+ }
+
+ /**
+ * Live Component actions (add/remove an item, a discount, a shipment...) only re-submit the
+ * raw form values onto a freshly instantiated order - nothing in Live Component itself
+ * recalculates derived data (unit prices, shipping cost, shipment/unit associations). Without
+ * this, every such action would render the order as if it had just been created empty: all
+ * prices at $0, shipments dropped, etc. This runs after Live Component's own form submission
+ * (which happens at the default #[PreReRender] priority of 0), never on the initial render.
+ */
+ #[PreReRender(priority: -10)]
+ public function reprocessOrder(): void
+ {
+ $order = $this->getForm()->getData();
+
+ if (!$order instanceof OrderInterface) {
+ return;
+ }
+
+ try {
+ $this->orderProcessor->process($order);
+ } catch (\Throwable) {
+ // Items freshly added on the create page have no variant selected yet, which the
+ // pricing processor can't handle - leave the order as submitted and let it settle
+ // once the user picks a variant and this hook runs again.
+ }
+ }
+
+ private function createOrder(): OrderInterface
+ {
+ return $this->orderFactory->createForCustomerAndChannel($this->customerId, $this->channelCode);
+ }
+
+ /**
+ * Builds a throwaway order from the current (live, not-yet-final) form values so that the
+ * shipment's "method" field can be restricted to the shipping methods actually eligible for
+ * the items/address entered so far, mirroring Sylius' own checkout behaviour.
+ *
+ * The eligibility restriction is only ever meant to guide a *new* selection. Never let it
+ * invalidate a method the admin already picked: zone matching on this throwaway, not-yet-fully
+ * submitted order can be momentarily narrower than on the final order (e.g. while the address
+ * form is only partially filled in across requests), and passing a subject whose eligible-method
+ * list excludes the already-chosen method makes Symfony's ChoiceType treat that submitted value
+ * as invalid - which silently drops the entire shipment from the collection instead of just
+ * rejecting the method field.
+ */
+ private function computeShipmentChoicesSubject(): ?ShipmentInterface
+ {
+ if ($this->formValues === []) {
+ return null;
+ }
+
+ try {
+ $order = $this->createOrder();
+ $this->formFactory->create(NewOrderType::class, $order)->submit($this->formValues);
+ $this->orderProcessor->process($order);
+ } catch (\Throwable) {
+ return null;
+ }
+
+ $shipment = $order->getShipments()->first();
+
+ if (!$shipment instanceof ShipmentInterface) {
+ return null;
+ }
+
+ if (
+ !$this->shippingMethodsResolver->supports($shipment) ||
+ !in_array($shipment->getMethod(), $this->shippingMethodsResolver->getSupportedMethods($shipment), true)
+ ) {
+ return null;
+ }
+
+ return $shipment;
+ }
+}
diff --git a/src/Twig/Component/OrderPreviewFormComponent.php b/src/Twig/Component/OrderPreviewFormComponent.php
new file mode 100644
index 000000000..7839d8806
--- /dev/null
+++ b/src/Twig/Component/OrderPreviewFormComponent.php
@@ -0,0 +1,15 @@
+addCompilerPass(new RegisterReorderProcessorsPass());
+ }
+
+ #[\Override]
+ public function getContainerExtension(): ?ExtensionInterface
+ {
+ return new SyliusAdminOrderCreationExtension();
+ }
+}
diff --git a/src/Resources/views/Emails/orderCreated.html.twig b/templates/emails/order_created.html.twig
similarity index 100%
rename from src/Resources/views/Emails/orderCreated.html.twig
rename to templates/emails/order_created.html.twig
diff --git a/templates/order/create.html.twig b/templates/order/create.html.twig
new file mode 100644
index 000000000..396a684fc
--- /dev/null
+++ b/templates/order/create.html.twig
@@ -0,0 +1,49 @@
+{% extends '@SyliusAdmin/shared/layout/base.html.twig' %}
+
+{% from '@SyliusAdmin/shared/helper/breadcrumbs.html.twig' import breadcrumbs %}
+
+{% if order is defined %}
+ {% set customer_id = order.customer.id %}
+ {% set channel_code = order.channel.code %}
+{% else %}
+ {% set customer_id = app.request.attributes.get('customerId') %}
+ {% set channel_code = app.request.attributes.get('channelCode') %}
+{% endif %}
+
+{% block title %}{{ 'sylius.ui.new_order'|trans }} {{ parent() }}{% endblock %}
+
+{% block body %}
+ {% include '@SyliusAdmin/shared/crud/common/sidebar.html.twig' %}
+ {% include '@SyliusAdmin/shared/crud/common/navbar.html.twig' %}
+
+
+ {% include '@SyliusAdmin/shared/crud/common/content/flashes.html.twig' %}
+
+
+
+
+
+ {% hook 'sylius_admin_order_creation.order.create.content' with {
+ customer_id: customer_id,
+ channel_code: channel_code,
+ form: form,
+ } %}
+
+
+
+ {% include '@SyliusAdmin/shared/crud/common/content/footer.html.twig' %}
+
+{% endblock %}
diff --git a/templates/order/create/_order_form_component.html.twig b/templates/order/create/_order_form_component.html.twig
new file mode 100644
index 000000000..1e963194d
--- /dev/null
+++ b/templates/order/create/_order_form_component.html.twig
@@ -0,0 +1,129 @@
+{% form_theme form '@WebgriffeSyliusAdminOrderCreationPlugin/order/item_collection_theme.html.twig' %}
+
+{% macro address_fields(address) %}
+ {{ form_row(address.firstName) }}
+ {{ form_row(address.lastName) }}
+ {{ form_row(address.phoneNumber) }}
+ {{ form_row(address.company) }}
+ {{ form_row(address.countryCode) }}
+
+ {% if address.provinceCode is defined %}{{ form_row(address.provinceCode) }}{% endif %}
+ {% if address.provinceName is defined %}{{ form_row(address.provinceName) }}{% endif %}
+
+ {{ form_row(address.street) }}
+ {{ form_row(address.city) }}
+ {{ form_row(address.postcode) }}
+{% endmacro %}
+
+
+ {{ form_start(form, {
+ 'action': path('sylius_admin_order_creation_order_preview', {'customerId': customerId, 'channelCode': channelCode}),
+ 'attr': {'novalidate': 'novalidate'},
+ }) }}
+ {{ form_errors(form) }}
+
+
+
+ {{ 'sylius.ui.items'|trans }}
+
+
+ {{ 'sylius.ui.shipping_address'|trans }} & {{ 'sylius.ui.billing_address'|trans }}
+
+
+ {{ 'sylius.ui.locale'|trans }} & {{ 'sylius.ui.currency'|trans }}
+
+
+ {{ 'sylius.ui.shipments'|trans }} & {{ 'sylius.ui.payments'|trans }}
+
+
+ {{ 'sylius_admin_order_creation.ui.order_discount'|trans }}
+
+
+
+
+
+
+
+
+ {{ form_row(form.items, {'label': false, 'skip_add_button': true}) }}
+
+ {{ form_row(form.items.vars.button_add, {'label': 'sylius_admin_order_creation.ui.add_item'|trans, 'attr': {'class': 'btn btn-outline-primary'}}) }}
+
+
+
+
+
+
+
+
+
+
+ {{ _self.address_fields(form.shippingAddress) }}
+
+
+
+
+
+
+
+ {{ _self.address_fields(form.billingAddress) }}
+
+
+
+
+
+
+
+
+
+
{{ form_row(form.localeCode) }}
+
{{ form_row(form.currencyCode) }}
+
+
+
+
+
+
+
+
+
+
+
{{ 'sylius_admin_order_creation.ui.shipping_methods_selection_requirement'|trans }}
+ {{ form_row(form.shipments, {'label': false, 'skip_add_button': true}) }}
+ {{ form_row(form.shipments.vars.button_add, {'label': 'sylius_admin_order_creation.ui.add_shipment'|trans, 'attr': {'class': 'btn btn-outline-primary'}}) }}
+
+
+
+
+
+
+
+ {{ form_row(form.payments, {'label': false, 'skip_add_button': true}) }}
+ {% if form.payments|length == 0 %}
+ {{ form_row(form.payments.vars.button_add, {'label': 'sylius_admin_order_creation.ui.add_payment'|trans, 'attr': {'class': 'btn btn-outline-primary'}}) }}
+ {% endif %}
+
+
+
+
+
+
+
+
+
+ {{ form_row(form.adjustments, {'label': false, 'skip_add_button': true}) }}
+ {{ form_row(form.adjustments.vars.button_add, {'attr': {'class': 'btn btn-outline-primary'}}) }}
+
+
+
+
+
+ {{ form_row(form.promotionCoupon) }}
+
+
+
{{ 'sylius.ui.cancel'|trans }}
+
{{ 'sylius_admin_order_creation.ui.order_preview'|trans }}
+
+
+ {{ form_end(form, {'render_rest': false}) }}
+
diff --git a/templates/order/create/sections/form.html.twig b/templates/order/create/sections/form.html.twig
new file mode 100644
index 000000000..e30eb097d
--- /dev/null
+++ b/templates/order/create/sections/form.html.twig
@@ -0,0 +1,5 @@
+{{ component('webgriffe_sylius_admin_order_creation:order_form', {
+ customerId: hookable_metadata.context.customer_id,
+ channelCode: hookable_metadata.context.channel_code,
+ form: hookable_metadata.context.form,
+}) }}
diff --git a/templates/order/item_collection_theme.html.twig b/templates/order/item_collection_theme.html.twig
new file mode 100644
index 000000000..b01347473
--- /dev/null
+++ b/templates/order/item_collection_theme.html.twig
@@ -0,0 +1,45 @@
+{% extends '@SyliusAdmin/shared/form_theme.html.twig' %}
+
+{% block _sylius_admin_order_creation_new_order_items_entry_row %}
+
+
+
{{ form_row(form.variant) }}
+
{{ form_row(form.quantity) }}
+
{{ form_widget(button_delete, {'label': 'sylius.ui.delete'|trans, 'attr': {'class': 'btn btn-outline-danger'}}) }}
+
+
+
+ {{ form_row(form.adjustments, {'label': false, 'skip_add_button': true}) }}
+ {{ form_row(form.adjustments.vars.button_add, {'attr': {'class': 'btn btn-outline-primary'}}) }}
+
+
+
+{% endblock %}
+
+{% block _sylius_admin_order_creation_new_order_order_item_adjustments_entry_row %}
+
+
{{ form_row(form.amount) }}
+ {{ form_widget(button_delete, {'label': 'sylius.ui.delete'|trans, 'attr': {'class': 'btn btn-outline-danger'}}) }}
+
+{% endblock %}
+
+{% block _sylius_admin_order_creation_new_order_adjustments_entry_row %}
+
+
{{ form_row(form.amount) }}
+ {{ form_widget(button_delete, {'label': 'sylius.ui.delete'|trans, 'attr': {'class': 'btn btn-outline-danger'}}) }}
+
+{% endblock %}
+
+{% block _sylius_admin_order_creation_new_order_shipments_entry_row %}
+
+
{{ form_row(form.method) }}
+ {{ form_widget(button_delete, {'label': 'sylius.ui.delete'|trans, 'attr': {'class': 'btn btn-outline-danger'}}) }}
+
+{% endblock %}
+
+{% block _sylius_admin_order_creation_new_order_payments_entry_row %}
+
+
{{ form_row(form.method) }}
+ {{ form_widget(button_delete, {'label': 'sylius.ui.delete'|trans, 'attr': {'class': 'btn btn-outline-danger'}}) }}
+
+{% endblock %}
diff --git a/templates/order/preview.html.twig b/templates/order/preview.html.twig
new file mode 100644
index 000000000..c41d8e549
--- /dev/null
+++ b/templates/order/preview.html.twig
@@ -0,0 +1,51 @@
+{% extends '@SyliusAdmin/shared/layout/base.html.twig' %}
+
+{% from '@SyliusAdmin/shared/helper/breadcrumbs.html.twig' import breadcrumbs %}
+{% from '@SyliusAdmin/order/macro/order_state_label.html.twig' import label as orderStateLabel %}
+
+{% set order = form.vars.data %}
+{% set customerId = app.request.attributes.get('customerId') %}
+{% set channelCode = app.request.attributes.get('channelCode') %}
+
+{% block title %}{{ 'sylius_admin_order_creation.ui.order_preview'|trans }} {{ parent() }}{% endblock %}
+
+{% block body %}
+ {% include '@SyliusAdmin/shared/crud/common/sidebar.html.twig' %}
+ {% include '@SyliusAdmin/shared/crud/common/navbar.html.twig' %}
+
+
+ {% include '@SyliusAdmin/shared/crud/common/content/flashes.html.twig' %}
+
+
+
+
+
+ {% hook 'sylius_admin_order_creation.order.preview.content' with {
+ customer_id: customerId,
+ channel_code: channelCode,
+ form: form,
+ } %}
+
+
+
+ {% include '@SyliusAdmin/shared/crud/common/content/footer.html.twig' %}
+
+{% endblock %}
diff --git a/templates/order/preview/_order_preview_form_component.html.twig b/templates/order/preview/_order_preview_form_component.html.twig
new file mode 100644
index 000000000..506c9f7dc
--- /dev/null
+++ b/templates/order/preview/_order_preview_form_component.html.twig
@@ -0,0 +1,190 @@
+{% from '@SyliusAdmin/shared/helper/address.html.twig' import address %}
+{% from '@SyliusAdmin/order/macro/order_payment_state_label.html.twig' import label as paymentStateLabel %}
+{% from '@SyliusAdmin/order/macro/order_shipping_state_label.html.twig' import label as shippingStateLabel %}
+
+{% form_theme form
+ '@SyliusAdmin/shared/form_theme.html.twig'
+ '@WebgriffeSyliusAdminOrderCreationPlugin/order/item_collection_theme.html.twig'
+ '@WebgriffeSyliusAdminOrderCreationPlugin/order/preview/item_collection_theme.html.twig'
+%}
+
+{% set order = form.vars.data %}
+
+{% macro nested_errors(field) %}
+ {{ form_errors(field) }}
+ {% for child in field %}
+ {{ _self.nested_errors(child) }}
+ {% endfor %}
+{% endmacro %}
+
+
+ {{ form_start(form, {'attr': {'novalidate': 'novalidate', 'id': form.vars.id}}) }}
+
+ {{ form_errors(form) }}
+ {{ _self.nested_errors(form.promotionCoupon) }}
+ {{ _self.nested_errors(form.shippingAddress) }}
+ {{ _self.nested_errors(form.billingAddress) }}
+ {{ _self.nested_errors(form.payments) }}
+ {{ _self.nested_errors(form.shipments) }}
+ {{ _self.nested_errors(form.localeCode) }}
+ {{ _self.nested_errors(form.currencyCode) }}
+
+
+
+
+
+
+
+
+
+ {{ 'sylius.ui.order_item_product'|trans }}
+ {{ 'sylius.ui.unit_price'|trans }}
+ {{ 'sylius.ui.item_discount'|trans }}
+ {{ 'sylius.ui.quantity'|trans }}
+ {{ 'sylius.ui.total'|trans }}
+
+
+
+ {{ form_row(form.items, {'label': false, 'skip_add_button': true}) }}
+
+
+
+ {{ 'sylius.ui.shipping_total'|trans }}
+ {{ order.shippingTotal|sylius_format_money(order.currencyCode) }}
+
+
+ {{ 'sylius.ui.total'|trans }}
+ {{ order.total|sylius_format_money(order.currencyCode) }}
+
+
+
+
+
+
+
+
+
+ {{ form_row(form.adjustments, {'label': false, 'skip_add_button': true}) }}
+ {{ form_row(form.adjustments.vars.button_add, {
+ 'label': 'sylius_admin_order_creation.ui.add_discount'|trans,
+ 'attr': {'class': 'btn btn-outline-primary'},
+ }) }}
+
+
+
+
+
+
+
+
+ {% if order.hasPayments %}
+
+
+
+ {% for payment in order.payments %}
+
+ {{ payment.method.name }}
+ {{ paymentStateLabel(payment.state) }}
+ {{ payment.amount|sylius_format_money(order.currencyCode) }}
+
+ {% endfor %}
+
+
+
+ {% else %}
+
{{ 'sylius.ui.no_payments'|trans }}
+ {% endif %}
+
+ {{ form_widget(form.sendPaymentLinkEmail, {
+ 'attr': {'class': 'form-check-input'},
+ }) }}
+ {{ form_label(form.sendPaymentLinkEmail, null, {'label_attr': {'class': 'form-check-label'}}) }}
+
+
+
+
+
+
+
+
+ {% if order.hasShipments %}
+
+
+
+ {% for shipment in order.shipments %}
+
+
+ {{ shipment.method.name }}
+ {{ ux_icon('tabler:world') }} {{ shipment.method.zone }}
+
+ {{ shippingStateLabel(shipment.state) }}
+
+ {% endfor %}
+
+
+
+ {% else %}
+
{{ 'sylius.ui.there_are_no_shipments_to_display'|trans }}
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
{{ 'sylius.ui.name'|trans }}:
+
{{ order.customer.fullName }}
+
{{ 'sylius.ui.email'|trans }}:
+
+ {% if order.customer.phoneNumber is not empty %}
+
{{ 'sylius.form.address.phone_number'|trans }}:
+
{{ order.customer.phoneNumber }}
+ {% endif %}
+
+
+
+
+
+
+ {% if order.shippingAddress is not null %}{{ address(order.shippingAddress) }}{% endif %}
+
+
+
+
+
+
+ {% if order.billingAddress is not null %}{{ address(order.billingAddress) }}{% endif %}
+
+
+
+
+
+
+ {{ form_rest(form) }}
+
+
+ {{ form_end(form, {'render_rest': false}) }}
+
+
+
+ {{ 'sylius.ui.back'|trans }}
+
+
+ {{ 'sylius_admin_order_creation.ui.confirm'|trans }}
+
+
+
diff --git a/templates/order/preview/item_collection_theme.html.twig b/templates/order/preview/item_collection_theme.html.twig
new file mode 100644
index 000000000..222d2fdbe
--- /dev/null
+++ b/templates/order/preview/item_collection_theme.html.twig
@@ -0,0 +1,42 @@
+{% block _sylius_admin_order_creation_new_order_items_entry_row %}
+ {% set item = form.vars.data %}
+ {% set variant = item.variant %}
+ {% set product = variant.product %}
+
+
+
+
+
+ {% if product.imagesByType('thumbnail') is not empty %}
+
+ {% elseif product.images.first %}
+
+ {% else %}
+
+ {% endif %}
+
+
+
{{ item.productName }}
+
{{ variant.code }}
+
{{ item.variantName }}
+
+
+
+ {{ item.unitPrice|sylius_format_money(item.order.currencyCode) }}
+
+ {{ form_row(form.adjustments, {'label': false, 'skip_add_button': true}) }}
+ {{ form_row(form.adjustments.vars.button_add, {
+ 'label': 'sylius_admin_order_creation.ui.add_discount'|trans,
+ 'attr': {'class': 'btn btn-sm btn-outline-primary'},
+ }) }}
+
+ {{ item.quantity }}
+ {{ item.total|sylius_format_money(item.order.currencyCode) }}
+
+
+
+ {{ form_widget(form.variant) }}
+ {{ form_widget(form.quantity) }}
+
+
+{% endblock %}
diff --git a/templates/order/preview/sections/form.html.twig b/templates/order/preview/sections/form.html.twig
new file mode 100644
index 000000000..4ae209564
--- /dev/null
+++ b/templates/order/preview/sections/form.html.twig
@@ -0,0 +1,5 @@
+{{ component('webgriffe_sylius_admin_order_creation:order_preview_form', {
+ customerId: hookable_metadata.context.customer_id,
+ channelCode: hookable_metadata.context.channel_code,
+ form: hookable_metadata.context.form,
+}) }}
diff --git a/templates/order/select_customer.html.twig b/templates/order/select_customer.html.twig
new file mode 100644
index 000000000..80def4b74
--- /dev/null
+++ b/templates/order/select_customer.html.twig
@@ -0,0 +1,43 @@
+{% extends '@SyliusAdmin/shared/layout/base.html.twig' %}
+
+{% from '@SyliusAdmin/shared/helper/breadcrumbs.html.twig' import breadcrumbs %}
+
+{% block title %}{{ 'sylius.ui.new_order'|trans }} {{ parent() }}{% endblock %}
+
+{% block body %}
+ {% include '@SyliusAdmin/shared/crud/common/sidebar.html.twig' %}
+ {% include '@SyliusAdmin/shared/crud/common/navbar.html.twig' %}
+
+
+ {% include '@SyliusAdmin/shared/crud/common/content/flashes.html.twig' %}
+
+
+
+
+
+
+ {% hook 'sylius_admin_order_creation.order.select_customer.content' with {
+ select_customer_form: selectCustomerForm,
+ create_customer_form: createCustomerForm,
+ } %}
+
+
+
+
+ {% include '@SyliusAdmin/shared/crud/common/content/footer.html.twig' %}
+
+{% endblock %}
diff --git a/templates/order/select_customer/sections/existing_customer.html.twig b/templates/order/select_customer/sections/existing_customer.html.twig
new file mode 100644
index 000000000..8e7727858
--- /dev/null
+++ b/templates/order/select_customer/sections/existing_customer.html.twig
@@ -0,0 +1,19 @@
+{% set selectCustomerForm = hookable_metadata.context.select_customer_form %}
+{% form_theme selectCustomerForm '@SyliusAdmin/shared/form_theme.html.twig' %}
+
+
+
+
+
+ {{ form_start(selectCustomerForm, {'method': 'GET'}) }}
+ {{ form_row(selectCustomerForm.customer) }}
+ {{ form_row(selectCustomerForm.channel) }}
+
+ {{ 'sylius.ui.next'|trans }}
+
+ {{ form_end(selectCustomerForm) }}
+
+
+
diff --git a/templates/order/select_customer/sections/new_customer.html.twig b/templates/order/select_customer/sections/new_customer.html.twig
new file mode 100644
index 000000000..7cae7a0e9
--- /dev/null
+++ b/templates/order/select_customer/sections/new_customer.html.twig
@@ -0,0 +1,19 @@
+{% set createCustomerForm = hookable_metadata.context.create_customer_form %}
+{% form_theme createCustomerForm '@SyliusAdmin/shared/form_theme.html.twig' %}
+
+
+
+
+
+ {{ form_start(createCustomerForm, {'method': 'GET'}) }}
+ {{ form_row(createCustomerForm.customerEmail) }}
+ {{ form_row(createCustomerForm.channel) }}
+
+ {{ ux_icon('tabler:plus') }} {{ 'sylius_admin_order_creation.ui.create_new'|trans }}
+
+ {{ form_end(createCustomerForm) }}
+
+
+
diff --git a/templates/order/show/sections/items/body/discounted_unit_price.html.twig b/templates/order/show/sections/items/body/discounted_unit_price.html.twig
new file mode 100644
index 000000000..cf2ae8929
--- /dev/null
+++ b/templates/order/show/sections/items/body/discounted_unit_price.html.twig
@@ -0,0 +1,17 @@
+{% import '@SyliusAdmin/shared/helper/money.html.twig' as money %}
+
+{% set unit_promotion_adjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT') %}
+{% set order_promotion_adjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT') %}
+{% set item_discount_adjustment = constant('Webgriffe\\SyliusAdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_ITEM_DISCOUNT_ADJUSTMENT') %}
+
+{% set order = hookable_metadata.context.resource %}
+{% set item = hookable_metadata.context.item %}
+{% set discountedUnitPrice = item.unitPrice
+ + item.units.first.getAdjustmentsTotal(unit_promotion_adjustment)
+ + item.units.first.getAdjustmentsTotal(order_promotion_adjustment)
+ + (item.getAdjustmentsTotal(item_discount_adjustment) // item.quantity)
+%}
+
+
+ {{ money.format(discountedUnitPrice, order.currencyCode) }}
+
diff --git a/templates/order/show/sections/items/body/subtotal.html.twig b/templates/order/show/sections/items/body/subtotal.html.twig
new file mode 100644
index 000000000..c4c70ea44
--- /dev/null
+++ b/templates/order/show/sections/items/body/subtotal.html.twig
@@ -0,0 +1,17 @@
+{% import '@SyliusAdmin/shared/helper/money.html.twig' as money %}
+
+{% set order_promotion_adjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT') %}
+{% set unit_promotion_adjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT') %}
+{% set item_discount_adjustment = constant('Webgriffe\\SyliusAdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_ITEM_DISCOUNT_ADJUSTMENT') %}
+
+{% set order = hookable_metadata.context.resource %}
+{% set item = hookable_metadata.context.item %}
+{% set aggregated_unit_promotion_adjustments = item.getAdjustmentsTotalRecursively(unit_promotion_adjustment)
+ + item.getAdjustmentsTotalRecursively(order_promotion_adjustment)
+ + item.getAdjustmentsTotal(item_discount_adjustment)
+%}
+{% set subtotal = (item.unitPrice * item.quantity) + aggregated_unit_promotion_adjustments %}
+
+
+ {{ money.format(subtotal, order.currencyCode) }}
+
diff --git a/templates/order/show/sections/items/body/unit_discount.html.twig b/templates/order/show/sections/items/body/unit_discount.html.twig
new file mode 100644
index 000000000..8e2f55cbb
--- /dev/null
+++ b/templates/order/show/sections/items/body/unit_discount.html.twig
@@ -0,0 +1,12 @@
+{% import '@SyliusAdmin/shared/helper/money.html.twig' as money %}
+
+{% set unit_promotion_adjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT') %}
+{% set item_discount_adjustment = constant('Webgriffe\\SyliusAdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_ITEM_DISCOUNT_ADJUSTMENT') %}
+
+{% set order = hookable_metadata.context.resource %}
+{% set item = hookable_metadata.context.item %}
+{% set unitDiscount = item.units.first.getAdjustmentsTotal(unit_promotion_adjustment) + (item.getAdjustmentsTotal(item_discount_adjustment) // item.quantity) %}
+
+
+ {{ money.format(unitDiscount, order.currencyCode) }}
+
diff --git a/templates/order/show/sections/payments/item/actions/pay_via_payment_link.html.twig b/templates/order/show/sections/payments/item/actions/pay_via_payment_link.html.twig
new file mode 100644
index 000000000..a33f95888
--- /dev/null
+++ b/templates/order/show/sections/payments/item/actions/pay_via_payment_link.html.twig
@@ -0,0 +1,7 @@
+{% set payment = hookable_metadata.context.payment %}
+
+{% if payment.details['payment-link'] is defined %}
+
+ {{ ux_icon('tabler:credit-card') }} {{ 'sylius_admin_order_creation.ui.pay'|trans }}
+
+{% endif %}
diff --git a/templates/order/show/sections/summary/order_discount.html.twig b/templates/order/show/sections/summary/order_discount.html.twig
new file mode 100644
index 000000000..fedee44bb
--- /dev/null
+++ b/templates/order/show/sections/summary/order_discount.html.twig
@@ -0,0 +1,11 @@
+{% import '@SyliusAdmin/shared/helper/money.html.twig' as money %}
+
+{% set order = hookable_metadata.context.resource %}
+{% set orderDiscountTotal = order.getAdjustmentsTotalRecursively(constant('Webgriffe\\SyliusAdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_DISCOUNT_ADJUSTMENT')) %}
+
+{% if orderDiscountTotal != 0 %}
+
+ {{ 'sylius_admin_order_creation.ui.order_discount'|trans }}:
+ {{ money.format(orderDiscountTotal, order.currencyCode) }}
+
+{% endif %}
diff --git a/tests/Application/.babelrc b/tests/Application/.babelrc
deleted file mode 100644
index e563a62ea..000000000
--- a/tests/Application/.babelrc
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "presets": [
- ["env", {
- "targets": {
- "node": "6"
- },
- "useBuiltIns": true
- }]
- ],
- "plugins": [
- ["transform-object-rest-spread", {
- "useBuiltIns": true
- }]
- ]
-}
diff --git a/tests/Application/.env b/tests/Application/.env
deleted file mode 100644
index f6712f172..000000000
--- a/tests/Application/.env
+++ /dev/null
@@ -1,36 +0,0 @@
-# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
-# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
-# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
-
-###> symfony/framework-bundle ###
-APP_ENV=dev
-APP_DEBUG=1
-APP_SECRET=EDITME
-###< symfony/framework-bundle ###
-
-###> doctrine/doctrine-bundle ###
-# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
-# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
-# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
-DATABASE_URL=mysql://root@127.0.0.1/sylius_admin_order_creation_plugin_%kernel.environment%?serverVersion=5.5
-###< doctrine/doctrine-bundle ###
-
-###> symfony/swiftmailer-bundle ###
-# For Gmail as a transport, use: "gmail://username:password@localhost"
-# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
-# Delivery is disabled by default via "null://localhost"
-MAILER_URL=smtp://localhost
-###< symfony/swiftmailer-bundle ###
-
-###> lexik/jwt-authentication-bundle ###
-JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
-JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
-JWT_PASSPHRASE=YOUR_SECRET_PASSPHRASE
-###< lexik/jwt-authentication-bundle ###
-
-###> symfony/messenger ###
-# Choose one of the transports below
-# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
-MESSENGER_TRANSPORT_DSN=doctrine://default
-# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
-###< symfony/messenger ###
diff --git a/tests/Application/.env.test b/tests/Application/.env.test
deleted file mode 100644
index 084908ecd..000000000
--- a/tests/Application/.env.test
+++ /dev/null
@@ -1,14 +0,0 @@
-APP_SECRET='ch4mb3r0f5ecr3ts'
-
-KERNEL_CLASS='Tests\Sylius\AdminOrderCreationPlugin\Application\Kernel'
-
-###> lexik/jwt-authentication-bundle ###
-JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private-test.pem
-JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public-test.pem
-JWT_PASSPHRASE=ALL_THAT_IS_GOLD_DOES_NOT_GLITTER_NOT_ALL_THOSE_WHO_WANDER_ARE_LOST
-###< lexik/jwt-authentication-bundle ###
-
-###> symfony/messenger ###
-# Sync transport turned for testing env for the ease of testing
-MESSENGER_TRANSPORT_DSN=sync://
-###< symfony/messenger ###
diff --git a/tests/Application/.eslintrc.js b/tests/Application/.eslintrc.js
deleted file mode 100644
index 92c4cee37..000000000
--- a/tests/Application/.eslintrc.js
+++ /dev/null
@@ -1,20 +0,0 @@
-module.exports = {
- extends: 'airbnb-base',
- env: {
- node: true,
- },
- rules: {
- 'object-shorthand': ['error', 'always', {
- avoidQuotes: true,
- avoidExplicitReturnArrows: true,
- }],
- 'function-paren-newline': ['error', 'consistent'],
- 'max-len': ['warn', 120, 2, {
- ignoreUrls: true,
- ignoreComments: false,
- ignoreRegExpLiterals: true,
- ignoreStrings: true,
- ignoreTemplateLiterals: true,
- }],
- },
-};
diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore
deleted file mode 100644
index 8ad1225e1..000000000
--- a/tests/Application/.gitignore
+++ /dev/null
@@ -1,22 +0,0 @@
-/public/assets
-/public/css
-/public/js
-/public/media/*
-!/public/media/image/
-/public/media/image/*
-!/public/media/image/.gitignore
-
-/node_modules
-
-###> symfony/framework-bundle ###
-/.env.*.local
-/.env.local
-/.env.local.php
-/public/bundles
-/var/
-/vendor/
-###< symfony/framework-bundle ###
-
-###> symfony/web-server-bundle ###
-/.web-server-pid
-###< symfony/web-server-bundle ###
diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php
deleted file mode 100644
index 0a45032b9..000000000
--- a/tests/Application/Kernel.php
+++ /dev/null
@@ -1,145 +0,0 @@
-getProjectDir() . '/var/cache/' . $this->environment;
- }
-
- public function getLogDir(): string
- {
- return $this->getProjectDir() . '/var/log';
- }
-
- public function registerBundles(): iterable
- {
- foreach ($this->getBundleListFiles() as $file) {
- yield from $this->registerBundlesFromFile($file);
- }
- }
-
- protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
- {
- foreach ($this->getBundleListFiles() as $file) {
- $container->addResource(new FileResource($file));
- }
-
- $container->setParameter('container.dumper.inline_class_loader', true);
-
- foreach ($this->getConfigurationDirectories() as $confDir) {
- $this->loadContainerConfiguration($loader, $confDir);
- }
- }
-
- protected function configureRoutes(RouteCollectionBuilder $routes): void
- {
- foreach ($this->getConfigurationDirectories() as $confDir) {
- $this->loadRoutesConfiguration($routes, $confDir);
- }
- }
-
- protected function getContainerBaseClass(): string
- {
- if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) {
- return MockerContainer::class;
- }
-
- return parent::getContainerBaseClass();
- }
-
- private function isTestEnvironment(): bool
- {
- return 0 === strpos($this->getEnvironment(), 'test');
- }
-
- private function loadContainerConfiguration(LoaderInterface $loader, string $confDir): void
- {
- $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
- }
-
- private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void
- {
- $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
- $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
- $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
- }
-
- /**
- * @return BundleInterface[]
- */
- private function registerBundlesFromFile(string $bundlesFile): iterable
- {
- $contents = require $bundlesFile;
-
- if (SyliusKernel::MINOR_VERSION > 10) {
- $contents = array_merge(
- ['Sylius\Calendar\SyliusCalendarBundle' => ['all' => true]],
- $contents
- );
- }
-
- foreach ($contents as $class => $envs) {
- if (isset($envs['all']) || isset($envs[$this->environment])) {
- yield new $class();
- }
- }
- }
-
- /**
- * @return string[]
- */
- private function getBundleListFiles(): array
- {
- return array_filter(
- array_map(
- static function (string $directory): string {
- return $directory . '/bundles.php';
- },
- $this->getConfigurationDirectories()
- ),
- 'file_exists'
- );
- }
-
- /**
- * @return string[]
- */
- private function getConfigurationDirectories(): array
- {
- $directories = [
- $this->getProjectDir() . '/config',
- $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION,
- ];
-
- return array_filter($directories, 'file_exists');
- }
-}
diff --git a/tests/Application/bin/console b/tests/Application/bin/console
deleted file mode 100755
index 0554a1962..000000000
--- a/tests/Application/bin/console
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env php
-getParameterOption(['--env', '-e'], null, true)) {
- putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
-}
-
-if ($input->hasParameterOption('--no-debug', true)) {
- putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
-}
-
-require dirname(__DIR__).'/config/bootstrap.php';
-
-if ($_SERVER['APP_DEBUG']) {
- umask(0000);
-
- if (class_exists(Debug::class)) {
- Debug::enable();
- }
-}
-
-$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
-$application = new Application($kernel);
-$application->run($input);
diff --git a/tests/Application/composer.json b/tests/Application/composer.json
deleted file mode 100644
index 04efc4311..000000000
--- a/tests/Application/composer.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name": "sylius/admin-order-creation-plugin-test-application",
- "description": "Sylius application for plugin testing purposes (composer.json needed for project dir resolving)",
- "license": "MIT"
-}
diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php
deleted file mode 100644
index 6bb0207a3..000000000
--- a/tests/Application/config/bootstrap.php
+++ /dev/null
@@ -1,21 +0,0 @@
-=1.2)
-if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
- $_SERVER += $env;
- $_ENV += $env;
-} elseif (!class_exists(Dotenv::class)) {
- throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
-} else {
- // load all the .env files
- (new Dotenv())->loadEnv(dirname(__DIR__).'/.env');
-}
-
-$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
-$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
-$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php
deleted file mode 100644
index 9669540b9..000000000
--- a/tests/Application/config/bundles.php
+++ /dev/null
@@ -1,59 +0,0 @@
- ['all' => true],
- Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
- Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
- Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
- Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
- Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
- Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true],
- Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true],
- Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true],
- Sylius\Bundle\LocaleBundle\SyliusLocaleBundle::class => ['all' => true],
- Sylius\Bundle\ProductBundle\SyliusProductBundle::class => ['all' => true],
- Sylius\Bundle\ChannelBundle\SyliusChannelBundle::class => ['all' => true],
- Sylius\Bundle\AttributeBundle\SyliusAttributeBundle::class => ['all' => true],
- Sylius\Bundle\TaxationBundle\SyliusTaxationBundle::class => ['all' => true],
- Sylius\Bundle\ShippingBundle\SyliusShippingBundle::class => ['all' => true],
- Sylius\Bundle\PaymentBundle\SyliusPaymentBundle::class => ['all' => true],
- Sylius\Bundle\MailerBundle\SyliusMailerBundle::class => ['all' => true],
- Sylius\Bundle\PromotionBundle\SyliusPromotionBundle::class => ['all' => true],
- Sylius\Bundle\AddressingBundle\SyliusAddressingBundle::class => ['all' => true],
- Sylius\Bundle\InventoryBundle\SyliusInventoryBundle::class => ['all' => true],
- Sylius\Bundle\TaxonomyBundle\SyliusTaxonomyBundle::class => ['all' => true],
- Sylius\Bundle\UserBundle\SyliusUserBundle::class => ['all' => true],
- Sylius\Bundle\CustomerBundle\SyliusCustomerBundle::class => ['all' => true],
- Sylius\Bundle\UiBundle\SyliusUiBundle::class => ['all' => true],
- Sylius\Bundle\ReviewBundle\SyliusReviewBundle::class => ['all' => true],
- Sylius\Bundle\CoreBundle\SyliusCoreBundle::class => ['all' => true],
- Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true],
- Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
- winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true],
- Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
- Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true],
- JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
- FOS\RestBundle\FOSRestBundle::class => ['all' => true],
- Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true],
- Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
- Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
- Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
- Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
- Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
- Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true],
- Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true],
- Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
- Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
- Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
- Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
- Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
- Sylius\AdminOrderCreationPlugin\SyliusAdminOrderCreationPlugin::class => ['all' => true],
- FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true],
- FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true],
- ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
- Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true],
- Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
- SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
- BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
- SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
-];
diff --git a/tests/Application/config/jwt/private-test.pem b/tests/Application/config/jwt/private-test.pem
deleted file mode 100644
index b5a5246db..000000000
--- a/tests/Application/config/jwt/private-test.pem
+++ /dev/null
@@ -1,51 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIJKAIBAAKCAgEAxuS1SudSNkjTQcP4H5SjzrdO29upko9KYZgUH6z5n+weDtIo
-5tysdm7xY3nNAU9ixo7wrBvttuf7T1fDCVJjhzqX5iewaCZks7q9kYygCbvmrAoc
-bx5D9EPZPH0sQQoa9gMuNou2nqWpVdTYCMAjxzVpqa2krioUzkBJzaWGDYiijv9q
-KbjWvRUUoYFNOFIFXHFFDrK5ISBC155XiETKyBYhB1wZVWX1tHe1nDW609BHAAsr
-1Ve3uiodzYzQ7S9Rw9Q6RCRSRgZRzFV1GTJEuyMpCCD51DA4otYeEPQf+8hvV3aK
-bSNydzrQICY95kfB0p9HxorBPh8QHq0qKZOIle1Aglp0UV3OWgXLWncNc0m8e8hT
-2I55lYkLio99/4PGfalAdJBPhKtTzbJllaERHOnlMkEvwk7eggkbbXEN/Ay6usi0
-R8mRaxhMkS9i8MxubgQBDsOomtegRqA1EzSGU/FJMS5g/I/gO9bjFu2l2LJwd6B4
-t/FZt/9mAIGYbIj5/Ykd0E1WIKYAIRUoyW1gTrGe70yxdHEPEILnZZMRVJzDbkVY
-fgKAFUpAUqbHTtS+YI6p9tjFuxBrc6GZR/kppL/MkEARDX0ZX3n4sPLQf/vdR7+K
-s8Yqws1IqsZ3h8iP8WpykbEwnd1w49A1ZBBinIXU3idf41EtQgawbpK5Oy0CAwEA
-AQKCAgAEdUnvBOJd3yIFHlxocM9/KbK10OWrKFUVfPAuiZUK1aMS1/kcu6OOAAyf
-GzLSLbJcGwYgBXw9llOWwrPXeKZMeK7A9PDKVNn7AVuQcKOBtFmGT6+1eesyBXdQ
-GMouJwjVrNqTVGxif/oct2mkQJJMu9DDgeXoFX9j5CMDXgt0MDTcmbMKfl8p29gb
-iqdtdME0AkH3A2CM8oktBhqWLlyRQZW58YGL3X41bl1+w+GNL+T3hkiUPqQaoykJ
-23cvadkeV5p6vomtkiSxPNUkHHFX9IDN8tdGv1H1rHD+FkrFPQfp4PlXWu0M6R+T
-KOhISiF5FCLqu197gfy9g0onpmvwTkQW0ap5kTMfmryhc2fSbGeQO1bDjnCQQ05/
-yXpu9dRvQQCbXsAIUaJUyOsgJy4tpOlmra9mFK0/+ObN7ZJDxYA1tHPKoArcSFnC
-L0nbMs7C5b5Njky10nD6d1hu+HBEB1g6wBmsOCEMNBd6AF9ABmA/TIGSS2rsjdf6
-eYytYSAlSVlYwel3mvtpwfq5/q1mPtr38ND192/FDCMoVWoUbpYTKQHvAYdodOyS
-DJNH6upchKdCMItv6K6rv4Rc+lN9lp/XGYlxO8BpXVO+IF/dD+6Rs5vv3Hk5lU3D
-aX/ALBTTN1Xe8JKaCHd4ji1rgsIOxRmXDqdy05kiQtt7LtkCDQKCAQEA5Xw9EjXw
-Wsb42j+Ew3ISAC92VBIBmSz6hnwX27vON51Bm3j86LV1GHl0PvEl0A7c46+scumG
-pKgY5qad1Z7FtyCi78a9cr7HVbX03QndFZpzD14oIugN7y3ecSppPI/hfmOwfOAa
-O8b2lg2A6s4QBG70SAGFVeTozxovL/V4EWly/NW/2gAe6ZAWU8c3XyJBMMhA5Ez8
-aZONHipHi+uAiOwsLth7rGZbjyF4/QpXJuKzZ8p8e43yJiCkV7F588akp13NDmIB
-qXHNLEUcE1SD4GGoFGEacOkVkXO5Bqyn15LACjyluhhzsl5IWdClRUfjgbg3ieWO
-wdHq3bL6TgFuBwKCAQEA3d+drcpzMUOJRrDr08yNr6ygkeIvRtX7De3ilhg0Y3G3
-L2/rexfe1i5yrSc5N5hTWjLOSUtT4AD4tIgvNwW4YRtdQ9eRr/aoFHy5w8oXm0z5
-TJta7yBgcXTc4xQE9XtVEL0OUOKXxrh+Y5HHh5do5blsNfutHqRjtKWvPp1kCHba
-GjMiLkleivE4WGMkuBXPa13GUe3UfxOQp3KfaNcWAlNhnbc/8ljQJ1YZEj3XDodB
-RvorGzw8m8U+yZ/rhslPiq2MD0IrKUg5/r1C8k6ZVTrcG82A3Su1gacpS4b3q84W
-r1AwM3iajzBnPkiRc98H7p07vwYCeLV2Lm/w/LZAKwKCAQEAqx0HYKPNk7KXbg08
-zoso9vBs9+TxQijyqQKwu4x/CKL+f5IoatCa/mPZlPE0872RYUjlek28stwQrTOB
-rv6TiKgSNl3ndz7f3X4ulf671lbzAnt/y/9iHH0ERzeLfrf+OMLWn1Zu2THTPjHV
-db+u289r4KEZreFg4sQweT88hycssXAkfMXoRtnEfDWoiQw+tcQr9s+cypBWAi8e
-aCtzDSWlEE0lcnhkPwaDc5KZR4p0oaivR2WhMGLYh/by6x2sOovL0bSsbo9HoIHr
-nFJBfzbyIDgDgjuadHlodpyZDjoDbd6o6GlBI7f/lNDp2w3uixQ0fWMpHkaLLUI+
-N5oDUwKCAQAIjvemHIkU/WXuNCTkpp9Qh3gqKG9qbBajEuoKoCRlMZ2/VrHera0K
-1f/Wbgzm+Bk/AXaznRQ/L8poLFil5rKWDFgspcQY5YrWP3lq9AC1HOMA8X0wfC88
-MSXUHJGUZo2Bd8l1lUgFglhdvuHTeSOyuNRTwMGMzQqLjViVMb0KFouTNyW6Y1oi
-QevKfQiNkUnO+m8L+gCYZkjOLL25bZKLxGufidINpx9gZRHSglApX05FTqEbC9fK
-qnEhlemf6WQIFWmxrPu9O+wAx4wtjJqdjweuit7NqUH3HluZbjtfhTOaz50MXzqX
-C2bwIBx8O74ylh4X4EN4JIfKgsbo+J7BAoIBAAJ72s6YSoHaQCYXynLhRGenVHtI
-rj6wNkwnBEsIDk9j8vt5fMJA1xRNZ0kA1mDAgDqq9ad2RpGcZH1jjvI5IPdB0dKE
-5fyKR5okRMNRMc2Sn5LOiLsSqnhHwZo1nEZP/UTcZvIKDqajy8t4cIvBEO1ol4D5
-DxiclH7UMAgwKemYbsBHOOscbN2Z3o41uzSKUhNlLV5GP3ZPMau+MHinIXtCjHdi
-Xu9eGA3GDD4/sU4JZTl1g/Rs48JEn2H800pVgyzkn9Q01hJZ0dSqy+Agcu3Yw6Sr
-XRaqXN38pEInJ+GAU6y+6/RsiHdF3YOOUOPUX6PCfu8BMLRFASAdMbwNBXk=
------END RSA PRIVATE KEY-----
diff --git a/tests/Application/config/jwt/public-test.pem b/tests/Application/config/jwt/public-test.pem
deleted file mode 100644
index e21c0559e..000000000
--- a/tests/Application/config/jwt/public-test.pem
+++ /dev/null
@@ -1,14 +0,0 @@
------BEGIN PUBLIC KEY-----
-MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxuS1SudSNkjTQcP4H5Sj
-zrdO29upko9KYZgUH6z5n+weDtIo5tysdm7xY3nNAU9ixo7wrBvttuf7T1fDCVJj
-hzqX5iewaCZks7q9kYygCbvmrAocbx5D9EPZPH0sQQoa9gMuNou2nqWpVdTYCMAj
-xzVpqa2krioUzkBJzaWGDYiijv9qKbjWvRUUoYFNOFIFXHFFDrK5ISBC155XiETK
-yBYhB1wZVWX1tHe1nDW609BHAAsr1Ve3uiodzYzQ7S9Rw9Q6RCRSRgZRzFV1GTJE
-uyMpCCD51DA4otYeEPQf+8hvV3aKbSNydzrQICY95kfB0p9HxorBPh8QHq0qKZOI
-le1Aglp0UV3OWgXLWncNc0m8e8hT2I55lYkLio99/4PGfalAdJBPhKtTzbJllaER
-HOnlMkEvwk7eggkbbXEN/Ay6usi0R8mRaxhMkS9i8MxubgQBDsOomtegRqA1EzSG
-U/FJMS5g/I/gO9bjFu2l2LJwd6B4t/FZt/9mAIGYbIj5/Ykd0E1WIKYAIRUoyW1g
-TrGe70yxdHEPEILnZZMRVJzDbkVYfgKAFUpAUqbHTtS+YI6p9tjFuxBrc6GZR/kp
-pL/MkEARDX0ZX3n4sPLQf/vdR7+Ks8Yqws1IqsZ3h8iP8WpykbEwnd1w49A1ZBBi
-nIXU3idf41EtQgawbpK5Oy0CAwEAAQ==
------END PUBLIC KEY-----
diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml
deleted file mode 100644
index 12be5a2c3..000000000
--- a/tests/Application/config/packages/_sylius.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-imports:
- - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }
-
- - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }
-
- - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }
-
- - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" }
-
- - { resource: "@SyliusAdminOrderCreationPlugin/Resources/config/app/config.yml" }
-
-parameters:
- sylius_core.public_dir: '%kernel.project_dir%/public'
-
-sylius_shop:
- product_grid:
- include_all_descendants: true
-
-sylius_customer:
- resources:
- customer:
- classes:
- repository: Tests\Sylius\AdminOrderCreationPlugin\Application\Doctrine\ORM\CustomerRepository
-
-sylius_product:
- resources:
- product_variant:
- classes:
- repository: Tests\Sylius\AdminOrderCreationPlugin\Application\Doctrine\ORM\ProductVariantRepository
diff --git a/tests/Application/config/packages/dev/framework.yaml b/tests/Application/config/packages/dev/framework.yaml
deleted file mode 100644
index 4b116defd..000000000
--- a/tests/Application/config/packages/dev/framework.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-framework:
- profiler: { only_exceptions: false }
diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml
deleted file mode 100644
index 2f32a9b18..000000000
--- a/tests/Application/config/packages/dev/jms_serializer.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-jms_serializer:
- visitors:
- json_serialization:
- options:
- - JSON_PRETTY_PRINT
- - JSON_UNESCAPED_SLASHES
- - JSON_PRESERVE_ZERO_FRACTION
- json_deserialization:
- options:
- - JSON_PRETTY_PRINT
- - JSON_UNESCAPED_SLASHES
- - JSON_PRESERVE_ZERO_FRACTION
diff --git a/tests/Application/config/packages/dev/monolog.yaml b/tests/Application/config/packages/dev/monolog.yaml
deleted file mode 100644
index da2b092de..000000000
--- a/tests/Application/config/packages/dev/monolog.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-monolog:
- handlers:
- main:
- type: stream
- path: "%kernel.logs_dir%/%kernel.environment%.log"
- level: debug
- firephp:
- type: firephp
- level: info
diff --git a/tests/Application/config/packages/dev/routing.yaml b/tests/Application/config/packages/dev/routing.yaml
deleted file mode 100644
index 4116679a2..000000000
--- a/tests/Application/config/packages/dev/routing.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-framework:
- router:
- strict_requirements: true
diff --git a/tests/Application/config/packages/dev/swiftmailer.yaml b/tests/Application/config/packages/dev/swiftmailer.yaml
deleted file mode 100644
index f43807805..000000000
--- a/tests/Application/config/packages/dev/swiftmailer.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-swiftmailer:
- disable_delivery: true
diff --git a/tests/Application/config/packages/dev/web_profiler.yaml b/tests/Application/config/packages/dev/web_profiler.yaml
deleted file mode 100644
index 1f1cb2bb4..000000000
--- a/tests/Application/config/packages/dev/web_profiler.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-web_profiler:
- toolbar: true
- intercept_redirects: false
diff --git a/tests/Application/config/packages/doctrine.yaml b/tests/Application/config/packages/doctrine.yaml
deleted file mode 100644
index f51ba5a22..000000000
--- a/tests/Application/config/packages/doctrine.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-parameters:
- # Adds a fallback DATABASE_URL if the env var is not set.
- # This allows you to run cache:warmup even if your
- # environment variables are not available yet.
- # You should not need to change this value.
- env(DATABASE_URL): ''
-
-doctrine:
- dbal:
- driver: 'pdo_mysql'
- server_version: '5.7'
- charset: UTF8
-
- url: '%env(resolve:DATABASE_URL)%'
diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml
deleted file mode 100644
index c2456bfdb..000000000
--- a/tests/Application/config/packages/doctrine_migrations.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-doctrine_migrations:
- storage:
- table_storage:
- table_name: sylius_migrations
- migrations_paths:
- 'DoctrineMigrations': '%kernel.project_dir%/src/Migrations'
diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml
deleted file mode 100644
index eaebb2776..000000000
--- a/tests/Application/config/packages/fos_rest.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-fos_rest:
- exception: true
- view:
- formats:
- json: true
- xml: true
- empty_content: 204
- format_listener:
- rules:
- - { path: '^/api/v1/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true }
- - { path: '^/', stop: true }
diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml
deleted file mode 100644
index 9b445011c..000000000
--- a/tests/Application/config/packages/framework.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-framework:
- secret: '%env(APP_SECRET)%'
- form: true
- csrf_protection: true
- session:
- handler_id: ~
diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/packages/jms_serializer.yaml
deleted file mode 100644
index ed7bc613f..000000000
--- a/tests/Application/config/packages/jms_serializer.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-jms_serializer:
- visitors:
- xml_serialization:
- format_output: '%kernel.debug%'
diff --git a/tests/Application/config/packages/lexik_jwt_authentication.yaml b/tests/Application/config/packages/lexik_jwt_authentication.yaml
deleted file mode 100644
index edfb69dc8..000000000
--- a/tests/Application/config/packages/lexik_jwt_authentication.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-lexik_jwt_authentication:
- secret_key: '%env(resolve:JWT_SECRET_KEY)%'
- public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
- pass_phrase: '%env(JWT_PASSPHRASE)%'
diff --git a/tests/Application/config/packages/liip_imagine.yaml b/tests/Application/config/packages/liip_imagine.yaml
deleted file mode 100644
index bb2e7ceb9..000000000
--- a/tests/Application/config/packages/liip_imagine.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-liip_imagine:
- resolvers:
- default:
- web_path:
- web_root: "%kernel.project_dir%/public"
- cache_prefix: "media/cache"
diff --git a/tests/Application/config/packages/prod/doctrine.yaml b/tests/Application/config/packages/prod/doctrine.yaml
deleted file mode 100644
index 2f16f0fde..000000000
--- a/tests/Application/config/packages/prod/doctrine.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-doctrine:
- orm:
- metadata_cache_driver:
- type: service
- id: doctrine.system_cache_provider
- query_cache_driver:
- type: service
- id: doctrine.system_cache_provider
- result_cache_driver:
- type: service
- id: doctrine.result_cache_provider
-
-services:
- doctrine.result_cache_provider:
- class: Symfony\Component\Cache\DoctrineProvider
- public: false
- arguments:
- - '@doctrine.result_cache_pool'
- doctrine.system_cache_provider:
- class: Symfony\Component\Cache\DoctrineProvider
- public: false
- arguments:
- - '@doctrine.system_cache_pool'
-
-framework:
- cache:
- pools:
- doctrine.result_cache_pool:
- adapter: cache.app
- doctrine.system_cache_pool:
- adapter: cache.system
diff --git a/tests/Application/config/packages/prod/jms_serializer.yaml b/tests/Application/config/packages/prod/jms_serializer.yaml
deleted file mode 100644
index c2881820f..000000000
--- a/tests/Application/config/packages/prod/jms_serializer.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-jms_serializer:
- visitors:
- json_serialization:
- options:
- - JSON_UNESCAPED_SLASHES
- - JSON_PRESERVE_ZERO_FRACTION
- json_deserialization:
- options:
- - JSON_UNESCAPED_SLASHES
- - JSON_PRESERVE_ZERO_FRACTION
diff --git a/tests/Application/config/packages/prod/monolog.yaml b/tests/Application/config/packages/prod/monolog.yaml
deleted file mode 100644
index 646121143..000000000
--- a/tests/Application/config/packages/prod/monolog.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-monolog:
- handlers:
- main:
- type: fingers_crossed
- action_level: error
- handler: nested
- nested:
- type: stream
- path: "%kernel.logs_dir%/%kernel.environment%.log"
- level: debug
diff --git a/tests/Application/config/packages/routing.yaml b/tests/Application/config/packages/routing.yaml
deleted file mode 100644
index 368bc7f49..000000000
--- a/tests/Application/config/packages/routing.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-framework:
- router:
- strict_requirements: ~
diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml
deleted file mode 100644
index efa460155..000000000
--- a/tests/Application/config/packages/security.yaml
+++ /dev/null
@@ -1,126 +0,0 @@
-security:
- providers:
- sylius_admin_user_provider:
- id: sylius.admin_user_provider.email_or_name_based
- sylius_shop_user_provider:
- id: sylius.shop_user_provider.email_or_name_based
- sylius_api_admin_user_provider:
- id: sylius.admin_user_provider.email_or_name_based
- sylius_api_shop_user_provider:
- id: sylius.shop_user_provider.email_or_name_based
-
- encoders:
- Sylius\Component\User\Model\UserInterface: argon2i
-
- firewalls:
- admin:
- switch_user: true
- context: admin
- pattern: "%sylius.security.admin_regex%"
- provider: sylius_admin_user_provider
- form_login:
- provider: sylius_admin_user_provider
- login_path: sylius_admin_login
- check_path: sylius_admin_login_check
- failure_path: sylius_admin_login
- default_target_path: sylius_admin_dashboard
- use_forward: false
- use_referer: true
- csrf_token_generator: security.csrf.token_manager
- csrf_parameter: _csrf_admin_security_token
- csrf_token_id: admin_authenticate
- remember_me:
- secret: "%env(APP_SECRET)%"
- path: "/%sylius_admin.path_name%"
- name: APP_ADMIN_REMEMBER_ME
- lifetime: 31536000
- remember_me_parameter: _remember_me
- logout:
- path: sylius_admin_logout
- target: sylius_admin_login
- anonymous: true
-
- new_api_admin_user:
- pattern: "%sylius.security.new_api_admin_regex%/.*"
- provider: sylius_api_admin_user_provider
- stateless: true
- anonymous: true
- json_login:
- check_path: "%sylius.security.new_api_admin_route%/authentication-token"
- username_path: email
- password_path: password
- success_handler: lexik_jwt_authentication.handler.authentication_success
- failure_handler: lexik_jwt_authentication.handler.authentication_failure
- guard:
- authenticators:
- - lexik_jwt_authentication.jwt_token_authenticator
-
- new_api_shop_user:
- pattern: "%sylius.security.new_api_shop_regex%/.*"
- provider: sylius_api_shop_user_provider
- stateless: true
- anonymous: true
- json_login:
- check_path: "%sylius.security.new_api_shop_route%/authentication-token"
- username_path: email
- password_path: password
- success_handler: lexik_jwt_authentication.handler.authentication_success
- failure_handler: lexik_jwt_authentication.handler.authentication_failure
- guard:
- authenticators:
- - lexik_jwt_authentication.jwt_token_authenticator
-
- shop:
- switch_user: { role: ROLE_ALLOWED_TO_SWITCH }
- context: shop
- pattern: "%sylius.security.shop_regex%"
- provider: sylius_shop_user_provider
- form_login:
- success_handler: sylius.authentication.success_handler
- failure_handler: sylius.authentication.failure_handler
- provider: sylius_shop_user_provider
- login_path: sylius_shop_login
- check_path: sylius_shop_login_check
- failure_path: sylius_shop_login
- default_target_path: sylius_shop_homepage
- use_forward: false
- use_referer: true
- csrf_token_generator: security.csrf.token_manager
- csrf_parameter: _csrf_shop_security_token
- csrf_token_id: shop_authenticate
- remember_me:
- secret: "%env(APP_SECRET)%"
- name: APP_SHOP_REMEMBER_ME
- lifetime: 31536000
- remember_me_parameter: _remember_me
- logout:
- path: sylius_shop_logout
- target: sylius_shop_login
- invalidate_session: false
- success_handler: sylius.handler.shop_user_logout
- anonymous: true
-
- dev:
- pattern: ^/(_(profiler|wdt)|css|images|js)/
- security: false
-
- access_control:
- - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] }
- - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS }
- - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] }
- - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS }
-
- - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY }
-
- - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY }
-
- - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS }
- - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER }
-
- - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS }
- - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER }
- - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY }
diff --git a/tests/Application/config/packages/staging/monolog.yaml b/tests/Application/config/packages/staging/monolog.yaml
deleted file mode 100644
index 646121143..000000000
--- a/tests/Application/config/packages/staging/monolog.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-monolog:
- handlers:
- main:
- type: fingers_crossed
- action_level: error
- handler: nested
- nested:
- type: stream
- path: "%kernel.logs_dir%/%kernel.environment%.log"
- level: debug
diff --git a/tests/Application/config/packages/staging/swiftmailer.yaml b/tests/Application/config/packages/staging/swiftmailer.yaml
deleted file mode 100644
index f43807805..000000000
--- a/tests/Application/config/packages/staging/swiftmailer.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-swiftmailer:
- disable_delivery: true
diff --git a/tests/Application/config/packages/stof_doctrine_extensions.yaml b/tests/Application/config/packages/stof_doctrine_extensions.yaml
deleted file mode 100644
index 7770f74e1..000000000
--- a/tests/Application/config/packages/stof_doctrine_extensions.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html
-# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/
-stof_doctrine_extensions:
- default_locale: '%locale%'
diff --git a/tests/Application/config/packages/swiftmailer.yaml b/tests/Application/config/packages/swiftmailer.yaml
deleted file mode 100644
index 3bab0d32f..000000000
--- a/tests/Application/config/packages/swiftmailer.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-swiftmailer:
- url: '%env(MAILER_URL)%'
diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml
deleted file mode 100644
index 76d7e5e11..000000000
--- a/tests/Application/config/packages/test/framework.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-framework:
- test: ~
- session:
- storage_id: session.storage.mock_file
diff --git a/tests/Application/config/packages/test/monolog.yaml b/tests/Application/config/packages/test/monolog.yaml
deleted file mode 100644
index 7e2b9e3aa..000000000
--- a/tests/Application/config/packages/test/monolog.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-monolog:
- handlers:
- main:
- type: stream
- path: "%kernel.logs_dir%/%kernel.environment%.log"
- level: error
diff --git a/tests/Application/config/packages/test/swiftmailer.yaml b/tests/Application/config/packages/test/swiftmailer.yaml
deleted file mode 100644
index c438f4b25..000000000
--- a/tests/Application/config/packages/test/swiftmailer.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-swiftmailer:
- disable_delivery: true
- logging: true
- spool:
- type: file
- path: "%kernel.cache_dir%/spool"
diff --git a/tests/Application/config/packages/test/sylius_theme.yaml b/tests/Application/config/packages/test/sylius_theme.yaml
deleted file mode 100644
index 4d34199f5..000000000
--- a/tests/Application/config/packages/test/sylius_theme.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-sylius_theme:
- sources:
- test: ~
diff --git a/tests/Application/config/packages/test/web_profiler.yaml b/tests/Application/config/packages/test/web_profiler.yaml
deleted file mode 100644
index 03752de21..000000000
--- a/tests/Application/config/packages/test/web_profiler.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-web_profiler:
- toolbar: false
- intercept_redirects: false
-
-framework:
- profiler: { collect: false }
diff --git a/tests/Application/config/packages/test_cached/doctrine.yaml b/tests/Application/config/packages/test_cached/doctrine.yaml
deleted file mode 100644
index 49528606d..000000000
--- a/tests/Application/config/packages/test_cached/doctrine.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-doctrine:
- orm:
- entity_managers:
- default:
- result_cache_driver:
- type: memcached
- host: localhost
- port: 11211
- query_cache_driver:
- type: memcached
- host: localhost
- port: 11211
- metadata_cache_driver:
- type: memcached
- host: localhost
- port: 11211
diff --git a/tests/Application/config/packages/test_cached/fos_rest.yaml b/tests/Application/config/packages/test_cached/fos_rest.yaml
deleted file mode 100644
index 2b4189da0..000000000
--- a/tests/Application/config/packages/test_cached/fos_rest.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-fos_rest:
- exception:
- debug: true
diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml
deleted file mode 100644
index 76d7e5e11..000000000
--- a/tests/Application/config/packages/test_cached/framework.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-framework:
- test: ~
- session:
- storage_id: session.storage.mock_file
diff --git a/tests/Application/config/packages/test_cached/monolog.yaml b/tests/Application/config/packages/test_cached/monolog.yaml
deleted file mode 100644
index 7e2b9e3aa..000000000
--- a/tests/Application/config/packages/test_cached/monolog.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-monolog:
- handlers:
- main:
- type: stream
- path: "%kernel.logs_dir%/%kernel.environment%.log"
- level: error
diff --git a/tests/Application/config/packages/test_cached/swiftmailer.yaml b/tests/Application/config/packages/test_cached/swiftmailer.yaml
deleted file mode 100644
index c438f4b25..000000000
--- a/tests/Application/config/packages/test_cached/swiftmailer.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-swiftmailer:
- disable_delivery: true
- logging: true
- spool:
- type: file
- path: "%kernel.cache_dir%/spool"
diff --git a/tests/Application/config/packages/test_cached/sylius_channel.yaml b/tests/Application/config/packages/test_cached/sylius_channel.yaml
deleted file mode 100644
index bab83ef25..000000000
--- a/tests/Application/config/packages/test_cached/sylius_channel.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-sylius_channel:
- debug: true
diff --git a/tests/Application/config/packages/test_cached/sylius_theme.yaml b/tests/Application/config/packages/test_cached/sylius_theme.yaml
deleted file mode 100644
index 4d34199f5..000000000
--- a/tests/Application/config/packages/test_cached/sylius_theme.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-sylius_theme:
- sources:
- test: ~
diff --git a/tests/Application/config/packages/test_cached/twig.yaml b/tests/Application/config/packages/test_cached/twig.yaml
deleted file mode 100644
index 8c6e0b401..000000000
--- a/tests/Application/config/packages/test_cached/twig.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-twig:
- strict_variables: true
diff --git a/tests/Application/config/packages/translation.yaml b/tests/Application/config/packages/translation.yaml
deleted file mode 100644
index 1f4f96646..000000000
--- a/tests/Application/config/packages/translation.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-framework:
- default_locale: '%locale%'
- translator:
- paths:
- - '%kernel.project_dir%/translations'
- fallbacks:
- - '%locale%'
- - 'en'
diff --git a/tests/Application/config/packages/twig.yaml b/tests/Application/config/packages/twig.yaml
deleted file mode 100644
index 3b315dcc1..000000000
--- a/tests/Application/config/packages/twig.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-twig:
- paths: ['%kernel.project_dir%/templates']
- debug: '%kernel.debug%'
- strict_variables: '%kernel.debug%'
diff --git a/tests/Application/config/packages/twig_extensions.yaml b/tests/Application/config/packages/twig_extensions.yaml
deleted file mode 100644
index c39fa7fab..000000000
--- a/tests/Application/config/packages/twig_extensions.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-services:
- _defaults:
- public: false
- autowire: true
- autoconfigure: true
-
- # Uncomment any lines below to activate that Twig extension
- #Twig\Extensions\ArrayExtension: ~
- #Twig\Extensions\DateExtension: ~
- #Twig\Extensions\IntlExtension: ~
- #Twig\Extensions\TextExtension: ~
- Twig\Extra\Intl\IntlExtension: ~
diff --git a/tests/Application/config/packages/validator.yaml b/tests/Application/config/packages/validator.yaml
deleted file mode 100644
index 61807db62..000000000
--- a/tests/Application/config/packages/validator.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-framework:
- validation:
- enable_annotations: true
diff --git a/tests/Application/config/routes.yaml b/tests/Application/config/routes.yaml
deleted file mode 100644
index 5f0779259..000000000
--- a/tests/Application/config/routes.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-sylius_admin_order_creation:
- resource: "@SyliusAdminOrderCreationPlugin/Resources/config/app/routing.yml"
diff --git a/tests/Application/config/routes/dev/web_profiler.yaml b/tests/Application/config/routes/dev/web_profiler.yaml
deleted file mode 100644
index 3e79dc212..000000000
--- a/tests/Application/config/routes/dev/web_profiler.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-_wdt:
- resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
- prefix: /_wdt
-
-_profiler:
- resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
- prefix: /_profiler
diff --git a/tests/Application/config/routes/liip_imagine.yaml b/tests/Application/config/routes/liip_imagine.yaml
deleted file mode 100644
index 201cbd5d4..000000000
--- a/tests/Application/config/routes/liip_imagine.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-_liip_imagine:
- resource: "@LiipImagineBundle/Resources/config/routing.yaml"
diff --git a/tests/Application/config/routes/sylius_admin.yaml b/tests/Application/config/routes/sylius_admin.yaml
deleted file mode 100644
index 1ba48d6cf..000000000
--- a/tests/Application/config/routes/sylius_admin.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-sylius_admin:
- resource: "@SyliusAdminBundle/Resources/config/routing.yml"
- prefix: /admin
diff --git a/tests/Application/config/routes/sylius_api.yaml b/tests/Application/config/routes/sylius_api.yaml
deleted file mode 100644
index ae01ffce8..000000000
--- a/tests/Application/config/routes/sylius_api.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-sylius_api:
- resource: "@SyliusApiBundle/Resources/config/routing.yml"
- prefix: "%sylius.security.new_api_route%"
diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml
deleted file mode 100644
index 2bb3bd2e1..000000000
--- a/tests/Application/config/routes/sylius_shop.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
-sylius_shop:
- resource: "@SyliusShopBundle/Resources/config/routing.yml"
- prefix: /{_locale}
- requirements:
- _locale: ^[a-z]{2}(?:_[A-Z]{2})?$
-
-sylius_shop_payum:
- resource: "@SyliusShopBundle/Resources/config/routing/payum.yml"
-
-sylius_shop_default_locale:
- path: /
- methods: [GET]
- defaults:
- _controller: sylius.controller.shop.locale_switch:switchAction
-
-# see https://web.dev/change-password-url/
-sylius_shop_request_password_reset_token_redirect:
- path: /.well-known/change-password
- methods: [GET]
- controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
- defaults:
- route: sylius_shop_request_password_reset_token
- permanent: false
diff --git a/tests/Application/config/services.yaml b/tests/Application/config/services.yaml
deleted file mode 100644
index 615506eb5..000000000
--- a/tests/Application/config/services.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-# Put parameters here that don't need to change on each machine where the app is deployed
-# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
-parameters:
- locale: en_US
diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml
deleted file mode 100644
index 8d1e8c8d1..000000000
--- a/tests/Application/config/services_test.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-imports:
- - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" }
- - { resource: "../../Behat/Resources/services.xml" }
diff --git a/tests/Application/gulpfile.babel.js b/tests/Application/gulpfile.babel.js
deleted file mode 100644
index bbf20669f..000000000
--- a/tests/Application/gulpfile.babel.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import chug from 'gulp-chug';
-import gulp from 'gulp';
-import yargs from 'yargs';
-
-const { argv } = yargs
- .options({
- rootPath: {
- description: ' path to web assets directory',
- type: 'string',
- requiresArg: true,
- required: false,
- },
- nodeModulesPath: {
- description: ' path to node_modules directory',
- type: 'string',
- requiresArg: true,
- required: false,
- },
- });
-
-const config = [
- '--rootPath',
- argv.rootPath || '../../../../../../../tests/Application/public/assets',
- '--nodeModulesPath',
- argv.nodeModulesPath || '../../../../../../../tests/Application/node_modules',
-];
-
-export const buildAdmin = function buildAdmin() {
- return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/gulpfile.babel.js', { read: false })
- .pipe(chug({ args: config, tasks: 'build' }));
-};
-buildAdmin.description = 'Build admin assets.';
-
-export const watchAdmin = function watchAdmin() {
- return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/gulpfile.babel.js', { read: false })
- .pipe(chug({ args: config, tasks: 'watch' }));
-};
-watchAdmin.description = 'Watch admin asset sources and rebuild on changes.';
-
-export const buildShop = function buildShop() {
- return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/gulpfile.babel.js', { read: false })
- .pipe(chug({ args: config, tasks: 'build' }));
-};
-buildShop.description = 'Build shop assets.';
-
-export const watchShop = function watchShop() {
- return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/gulpfile.babel.js', { read: false })
- .pipe(chug({ args: config, tasks: 'watch' }));
-};
-watchShop.description = 'Watch shop asset sources and rebuild on changes.';
-
-export const build = gulp.parallel(buildAdmin, buildShop);
-build.description = 'Build assets.';
-
-gulp.task('admin', buildAdmin);
-gulp.task('admin-watch', watchAdmin);
-gulp.task('shop', buildShop);
-gulp.task('shop-watch', watchShop);
-
-export default build;
diff --git a/tests/Application/package.json b/tests/Application/package.json
deleted file mode 100644
index 9271063f9..000000000
--- a/tests/Application/package.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "dependencies": {
- "babel-polyfill": "^6.26.0",
- "chart.js": "^2.9.3",
- "jquery": "^3.2.0",
- "lightbox2": "^2.9.0",
- "semantic-ui-css": "^2.2.0",
- "slick-carousel": "^1.8.1"
- },
- "devDependencies": {
- "@symfony/webpack-encore": "^0.28.0",
- "babel-core": "^6.26.3",
- "babel-plugin-external-helpers": "^6.22.0",
- "babel-plugin-module-resolver": "^3.1.1",
- "babel-plugin-transform-object-rest-spread": "^6.26.0",
- "babel-preset-env": "^1.7.0",
- "babel-register": "^6.26.0",
- "dedent": "^0.7.0",
- "eslint": "^4.19.1",
- "eslint-config-airbnb-base": "^12.1.0",
- "eslint-import-resolver-babel-module": "^4.0.0",
- "eslint-plugin-import": "^2.12.0",
- "fast-async": "^6.3.7",
- "gulp": "^4.0.0",
- "gulp-chug": "^0.5",
- "gulp-concat": "^2.6.0",
- "gulp-debug": "^2.1.2",
- "gulp-if": "^2.0.0",
- "gulp-livereload": "^3.8.1",
- "gulp-order": "^1.1.1",
- "gulp-sass": "^4.0.1",
- "gulp-sourcemaps": "^1.6.0",
- "gulp-uglifycss": "^1.0.5",
- "merge-stream": "^1.0.0",
- "rollup": "^0.60.7",
- "rollup-plugin-babel": "^3.0.4",
- "rollup-plugin-commonjs": "^9.1.3",
- "rollup-plugin-inject": "^2.0.0",
- "rollup-plugin-node-resolve": "^3.3.0",
- "rollup-plugin-uglify": "^4.0.0",
- "sass-loader": "^7.0.1",
- "upath": "^1.1.0",
- "yargs": "^6.4.0"
- },
- "scripts": {
- "build": "gulp build",
- "gulp": "gulp build",
- "lint": "yarn lint:js",
- "lint:js": "eslint gulpfile.babel.js"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/Sylius/Sylius.git"
- },
- "author": "Paweł Jędrzejewski",
- "license": "MIT"
-}
diff --git a/tests/Application/public/.htaccess b/tests/Application/public/.htaccess
deleted file mode 100644
index 99ed00df8..000000000
--- a/tests/Application/public/.htaccess
+++ /dev/null
@@ -1,25 +0,0 @@
-DirectoryIndex app.php
-
-
- RewriteEngine On
-
- RewriteCond %{HTTP:Authorization} ^(.*)
- RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
-
- RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
- RewriteRule ^(.*) - [E=BASE:%1]
-
- RewriteCond %{ENV:REDIRECT_STATUS} ^$
- RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
-
- RewriteCond %{REQUEST_FILENAME} -f
- RewriteRule .? - [L]
-
- RewriteRule .? %{ENV:BASE}/index.php [L]
-
-
-
-
- RedirectMatch 302 ^/$ /index.php/
-
-
diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php
deleted file mode 100644
index c8a547664..000000000
--- a/tests/Application/public/index.php
+++ /dev/null
@@ -1,27 +0,0 @@
-handle($request);
-$response->send();
-$kernel->terminate($request, $response);
diff --git a/tests/Application/public/robots.txt b/tests/Application/public/robots.txt
deleted file mode 100644
index 214e41196..000000000
--- a/tests/Application/public/robots.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# www.robotstxt.org/
-# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
-
-User-agent: *
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/Summary/_item.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/Summary/_item.html.twig
deleted file mode 100644
index fe177a554..000000000
--- a/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/Summary/_item.html.twig
+++ /dev/null
@@ -1,52 +0,0 @@
-{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %}
-
-{% set orderPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT') %}
-{% set unitPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT') %}
-{% set shippingAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::SHIPPING_ADJUSTMENT') %}
-{% set taxAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::TAX_ADJUSTMENT') %}
-{% set orderItemDiscountAdjustment = constant('Sylius\\AdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_ITEM_DISCOUNT_ADJUSTMENT') %}
-
-{% set variant = item.variant %}
-{% set product = variant.product %}
-
-{% set unitDiscount = item.units.first.adjustmentsTotal(unitPromotionAdjustment) + item.getAdjustmentsTotalRecursively(orderItemDiscountAdjustment) / item.quantity %}
-{% set discountedUnitPrice = item.fullDiscountedUnitPrice + item.getAdjustmentsTotalRecursively(orderItemDiscountAdjustment) / item.quantity %}
-{% set subtotal = item.quantity * (item.unitPrice + item.units.first.adjustmentsTotal(unitPromotionAdjustment) + item.units.first.adjustmentsTotal(orderPromotionAdjustment)) + item.getAdjustmentsTotalRecursively(orderItemDiscountAdjustment) %}
-
-{% set taxIncluded = sylius_admin_order_unit_tax_included(item) %}
-{% set taxExcluded = sylius_admin_order_unit_tax_excluded(item) %}
-
-
-
- {% include '@SyliusAdmin/Product/_info.html.twig' %}
-
-
- {{ money.format(item.unitPrice, order.currencyCode) }}
-
-
- {{ money.format(unitDiscount, order.currencyCode) }}
-
-
- {{ money.format(item.units.first.adjustmentsTotal(orderPromotionAdjustment), order.currencyCode) }}
-
-
- {{ money.format(discountedUnitPrice, order.currencyCode) }}
-
-
- {{ item.quantity }}
-
-
- {{ money.format(subtotal, order.currencyCode) }}
-
-
- {{ money.format(taxExcluded, order.currencyCode) }}
-
-
{{ money.format(taxIncluded, order.currencyCode) }}
-
-
({{ 'sylius.ui.included_in_price'|trans }})
-
-
-
- {{ money.format(item.total, order.currencyCode) }}
-
-
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig
deleted file mode 100644
index 54e45f6a0..000000000
--- a/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig
+++ /dev/null
@@ -1,70 +0,0 @@
-{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %}
-
-{% set orderPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT') %}
-{% set orderShippingPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT') %}
-{% set itemPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT') %}
-{% set shippingAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::SHIPPING_ADJUSTMENT') %}
-{% set taxAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::TAX_ADJUSTMENT') %}
-{% set orderDiscountAdjustment = constant('Sylius\\AdminOrderCreationPlugin\\Form\\Type\\AdjustmentType::ORDER_DISCOUNT_ADJUSTMENT') %}
-
-{% set orderShippingPromotions = sylius_aggregate_adjustments(order.getAdjustmentsRecursively(orderShippingPromotionAdjustment)) %}
-
-
-
-
- {{ 'sylius.ui.tax_total'|trans }} :
- {{ money.format(order.taxTotal, order.currencyCode) }}
-
-
- {{ 'sylius.ui.items_total'|trans }} :
- {{ money.format(order.itemsTotal, order.currencyCode) }}
-
-
-
-
- {% if not order.adjustments(shippingAdjustment).isEmpty() %}
-
-
{{ 'sylius.ui.shipping'|trans }}:
- {% for adjustment in order.adjustments(shippingAdjustment) %}
-
-
{{ money.format(adjustment.amount, order.currencyCode) }}
-
-
- {{ adjustment.label }} :
-
-
-
- {% endfor %}
-
- {% else %}
- {{ 'sylius.ui.no_shipping_charges'|trans }}
- {% endif %}
-
- {% if not orderShippingPromotions is empty %}
-
-
-
{{ 'sylius.ui.shipping_discount'|trans }}:
- {% for label, amount in orderShippingPromotions %}
-
-
- {{ money.format(amount, order.currencyCode) }}
-
-
- {% endfor %}
-
-
- {% endif %}
-
- {{ 'sylius.ui.shipping_total'|trans }} :
- {{ money.format(order.shippingTotal, order.currencyCode) }}
-
-
-
-{% include '@SyliusAdmin/Order/Show/Summary/_totalsPromotions.html.twig' %}
-
-
-
-
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_payment.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_payment.html.twig
deleted file mode 100644
index 72e0eaa99..000000000
--- a/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_payment.html.twig
+++ /dev/null
@@ -1,44 +0,0 @@
-{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %}
-{% import '@SyliusUi/Macro/labels.html.twig' as label %}
-
-
-
- {% include '@SyliusAdmin/Common/Label/paymentState.html.twig' with {'data': payment.state} %}
-
-
-
-
-
- {{ money.format(payment.amount, payment.order.currencyCode) }}
-
-
- {% if sm_can(payment, 'complete', 'sylius_payment') %}
-
-
-
- {% if payment.details['payment-link'] is defined %}
-
- {% endif %}
- {% endif %}
- {% if sm_can(payment, 'refund', 'sylius_payment') %}
-
-
-
- {% endif %}
-
diff --git a/tests/Behat/Context/Admin/ManagingOrdersContext.php b/tests/Behat/Context/Admin/ManagingOrdersContext.php
index b3a0b4a0b..b8201d941 100644
--- a/tests/Behat/Context/Admin/ManagingOrdersContext.php
+++ b/tests/Behat/Context/Admin/ManagingOrdersContext.php
@@ -2,23 +2,23 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Context\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Context\Admin;
use Behat\Behat\Context\Context;
use Sylius\Behat\NotificationType;
+use Sylius\Behat\Service\Checker\EmailCheckerInterface;
use Sylius\Behat\Service\NotificationCheckerInterface;
use Sylius\Component\Addressing\Comparator\AddressComparatorInterface;
use Sylius\Component\Core\Model\AddressInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\ProductInterface;
-use Sylius\Component\Core\Test\Services\EmailCheckerInterface;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Element\Admin\OrderCreateFormElementInterface;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin\NewOrderCustomerPageInterface;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin\OrderIndexPageInterface;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin\OrderPreviewPageInterface;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin\OrderShowPageInterface;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin\ReorderPageInterface;
+use Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Element\Admin\OrderCreateFormElementInterface;
+use Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin\NewOrderCustomerPageInterface;
+use Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin\OrderIndexPageInterface;
+use Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin\OrderPreviewPageInterface;
+use Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin\OrderShowPageInterface;
+use Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin\ReorderPageInterface;
use Webmozart\Assert\Assert;
final class ManagingOrdersContext implements Context
@@ -59,7 +59,7 @@ public function __construct(
OrderCreateFormElementInterface $orderCreateFormElement,
NotificationCheckerInterface $notificationChecker,
EmailCheckerInterface $emailChecker,
- AddressComparatorInterface $addressComparator
+ AddressComparatorInterface $addressComparator,
) {
$this->orderIndexPage = $orderIndexPage;
$this->newOrderCustomerPage = $newOrderCustomerPage;
@@ -237,7 +237,7 @@ public function lowerItemWithProductPriceBy(ProductInterface $product, string $d
{
$this->orderPreviewPage->lowerItemWithProductPriceBy(
$product->getCode(),
- str_replace(['$', '€', '£'], '', $discount)
+ str_replace(['$', '€', '£'], '', $discount),
);
}
@@ -270,6 +270,14 @@ public function confirmThisOrder(): void
$this->orderPreviewPage->confirm();
}
+ /**
+ * @When I want to send a payment link email to the customer
+ */
+ public function iWantToSendAPaymentLinkEmailToTheCustomer(): void
+ {
+ $this->orderPreviewPage->checkSendPaymentLinkEmail();
+ }
+
/**
* @When I go back to the order creation
*/
@@ -322,7 +330,7 @@ public function shouldBeNotifiedAboutShippingMethodsSelectionRequirements(): voi
{
Assert::same(
'You need to add some items and shipping address to select from eligible shipping method',
- $this->orderCreateFormElement->getShippingMethodsValidationMessage()
+ $this->orderCreateFormElement->getShippingMethodsValidationMessage(),
);
}
@@ -333,7 +341,7 @@ public function shouldBeNotifiedThatOrderHasBeenSuccessfullyCreated(): void
{
$this->notificationChecker->checkNotification(
'Order has been successfully created',
- NotificationType::success()
+ NotificationType::success(),
);
}
@@ -351,7 +359,7 @@ public function shouldBeNotifiedThatOrderDiscountCannotBeBelow0(): void
public function shouldBeNotifiedThatItemWithProductDiscountCannotBeBelow0(ProductInterface $product): void
{
Assert::true(
- $this->orderPreviewPage->hasItemDiscountValidationMessage($product->getCode(), 'Discount cannot be below 0')
+ $this->orderPreviewPage->hasItemDiscountValidationMessage($product->getCode(), 'Discount cannot be below 0'),
);
}
@@ -386,7 +394,7 @@ public function thereShouldBePaymentLinkSentTo(string $email): void
{
Assert::true($this->emailChecker->hasMessageTo(
'New order has been created for you in Admin panel. Check it out in your orders history. To pay for this order, click',
- $email
+ $email,
));
}
@@ -395,13 +403,10 @@ public function thereShouldBePaymentLinkSentTo(string $email): void
*/
public function thereShouldBeNoPaymentLinkSentTo(string $email): void
{
- try {
- $this->emailChecker->countMessagesTo($email);
- } catch (\InvalidArgumentException $exception) {
- return;
- }
-
- throw new \Exception('There should be no messages exception thrown');
+ Assert::false($this->emailChecker->hasMessageTo(
+ 'New order has been created for you in Admin panel. Check it out in your orders history. To pay for this order, click',
+ $email,
+ ));
}
/**
@@ -416,7 +421,7 @@ public function thereShouldBeOneOrderForInTheRegistry(string $channelName, Custo
'state' => 'New',
'paymentState' => 'Awaiting payment',
'shippingState' => 'Ready',
- 'channel' => $channelName
+ 'channel' => $channelName,
]));
}
@@ -434,7 +439,7 @@ public function thereShouldBeOneOrdersForInTheRegistry(int $amountOfOrders, Cust
'state' => 'New',
'paymentState' => 'Awaiting payment',
'shippingState' => 'Ready',
- ])
+ ]),
);
}
@@ -446,7 +451,7 @@ public function thisOrderShippingAddressShouldBe(
string $street,
string $postcode,
string $city,
- string $countryName
+ string $countryName,
): void {
Assert::true($this->orderShowPage->hasShippingAddress($customerName, $street, $postcode, $city, $countryName));
}
@@ -459,7 +464,7 @@ public function thisOrderBillingAddressShouldBe(
string $street,
string $postcode,
string $city,
- string $countryName
+ string $countryName,
): void {
Assert::true($this->orderShowPage->hasBillingAddress($customerName, $street, $postcode, $city, $countryName));
}
@@ -536,6 +541,22 @@ public function shouldBeAbleToConfirmOrderCreation(): void
Assert::true($this->orderPreviewPage->hasConfirmButton());
}
+ /**
+ * @Then I should see a validation error
+ */
+ public function iShouldSeeAValidationError(): void
+ {
+ Assert::true($this->orderCreateFormElement->hasValidationErrors());
+ }
+
+ /**
+ * @Then I should still be on the order creation form
+ */
+ public function iShouldStillBeOnTheOrderCreationForm(): void
+ {
+ Assert::true($this->orderCreateFormElement->isDisplayed());
+ }
+
/**
* @Then the product named :productName should not be in the items list
*/
diff --git a/tests/Behat/Context/Setup/PaymentContext.php b/tests/Behat/Context/Setup/PaymentContext.php
new file mode 100644
index 000000000..ba8424eb5
--- /dev/null
+++ b/tests/Behat/Context/Setup/PaymentContext.php
@@ -0,0 +1,44 @@
+paymentMethodExampleFactory->create([
+ 'name' => $paymentMethodName,
+ 'code' => $paymentMethodCode,
+ 'gatewayName' => $gatewayLabel,
+ 'gatewayFactory' => StringInflector::nameToLowercaseCode($gatewayLabel),
+ 'enabled' => true,
+ 'channels' => $this->sharedStorage->has('channel') ? [$this->sharedStorage->get('channel')] : [],
+ ]);
+
+ $this->sharedStorage->set('payment_method', $paymentMethod);
+ $this->paymentMethodRepository->add($paymentMethod);
+ }
+}
diff --git a/tests/Behat/Element/Admin/OrderCreateFormElement.php b/tests/Behat/Element/Admin/OrderCreateFormElement.php
index a9444fa2b..dca5e6317 100644
--- a/tests/Behat/Element/Admin/OrderCreateFormElement.php
+++ b/tests/Behat/Element/Admin/OrderCreateFormElement.php
@@ -2,270 +2,290 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Element\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Element\Admin;
-use Behat\Mink\Driver\Selenium2Driver;
use Behat\Mink\Element\NodeElement;
-use Behat\Mink\Exception\Exception;
use Behat\Mink\Session;
-use DMore\ChromeDriver\ChromeDriver;
+use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
use Sylius\Component\Core\Model\AddressInterface;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Element\Element;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Service\AutoCompleteSelector;
+use Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Element\Element;
class OrderCreateFormElement extends Element implements OrderCreateFormElementInterface
{
- public const TYPE_BILLING = 'billing';
- public const TYPE_SHIPPING = 'shipping';
-
- /** @var AutoCompleteSelector */
- private $autoCompleteSelector;
public function __construct(
Session $session,
$parameters,
- AutoCompleteSelector $autoCompleteSelector
+ private readonly AutocompleteHelperInterface $autocompleteHelper,
) {
parent::__construct($session, $parameters);
-
- $this->autoCompleteSelector = $autoCompleteSelector;
}
public function addProduct(string $productVariantDescriptor): void
{
- $this->clickOnTabAndWait('Items');
$item = $this->addItemAndWaitForIt();
- $this->autoCompleteSelector->selectOption($item, $productVariantDescriptor);
+ $this->autocompleteHelper->selectByName(
+ $this->getDriver(),
+ $this->getVariantSelect($item)->getXpath(),
+ $productVariantDescriptor,
+ );
+ $this->waitForComponentIdle();
}
public function addMultipleProducts(string $productVariantDescriptor, int $quantity): void
{
- $this->clickOnTabAndWait('Items');
-
$item = $this->addItemAndWaitForIt();
- $this->autoCompleteSelector->selectOption($item, $productVariantDescriptor);
- $item->fillField('Quantity', $quantity);
+ $this->autocompleteHelper->selectByName(
+ $this->getDriver(),
+ $this->getVariantSelect($item)->getXpath(),
+ $productVariantDescriptor,
+ );
+ $this->waitForComponentIdle();
+ $item->fillField('Quantity', (string) $quantity);
+ $this->waitForComponentIdle();
}
public function removeProduct(string $productVariantDescriptor): void
{
$item = $this->getItemWithProductSelected($productVariantDescriptor);
- $item->focus();
-
- $item->clickLink('Delete');
+ $item->pressButton('Delete');
+ $this->waitForComponentIdle();
}
public function areProductsVisible(): bool
{
- $this->clickOnTabAndWait('Items');
-
+ $this->clickOnTab('items');
$item = $this->addItemAndWaitForIt();
- return $this->autoCompleteSelector->areItemsVisible($item);
+ $results = $this->autocompleteHelper->search(
+ $this->getDriver(),
+ $this->getVariantSelect($item)->getXpath(),
+ 'a',
+ );
+
+ return [] !== $results;
}
public function specifyShippingAddress(AddressInterface $address): void
{
- $this->clickOnTabAndWait('Shipping address & Billing address');
+ $this->clickOnTab('addresses');
$this->fillAddressData(
$this->getDocument()->find('css', 'div[id*="shippingAddress"]'),
- $address
+ $address,
);
}
public function specifyBillingAddress(AddressInterface $address): void
{
+ $this->clickOnTab('addresses');
+
$this->fillAddressData(
$this->getDocument()->find('css', 'div[id*="billingAddress"]'),
- $address
+ $address,
);
}
public function getAvailableShippingMethods(): array
{
- $this->clickOnTabAndWait('Shipments & Payments');
+ $shipmentRow = $this->addShipmentRowAndWaitForIt();
- $shipmentsCollection = $this->getDocument()->find('css', '#sylius_admin_order_creation_new_order_shipments');
+ $shippingMethods = $shipmentRow->findAll('css', 'select[name$="[method]"] option');
- if (count($shipmentsCollection->findAll('css', '[data-form-collection="item"]')) === 0) {
- $shipmentsCollection->clickLink('Add');
- }
-
- $this->waitForFormToLoad();
-
- $shippingMethods = $this->getDocument()->findAll(
- 'css', '#sylius_admin_order_creation_new_order_shipments [data-form-collection="item"]:last-child select option'
- );
-
- $shippingMethods = array_map(function(NodeElement $option) : string {
- return $option->getText();
- }, $shippingMethods);
-
- return $shippingMethods;
+ return array_map(static fn (NodeElement $option): string => $option->getText(), $shippingMethods);
}
public function moveToShippingAndPaymentsSection(): void
{
- $this->clickOnTabAndWait('Shipments & Payments');
+ $this->clickOnTab('shipping-payment');
}
public function selectShippingMethod(string $shippingMethodName): void
{
- $this->selectMethod('shipments', 'Shipping Method', $shippingMethodName, true);
+ $shipmentRow = $this->addShipmentRowAndWaitForIt();
+ $shipmentRow->selectFieldOption('Shipping Method', $shippingMethodName);
}
public function changeShippingMethod(string $shippingMethodName): void
{
- $this->selectMethod('shipments', 'Shipping Method', $shippingMethodName, false);
+ $this->clickOnTab('shipping-payment');
+ $this->waitForComponentIdle();
+
+ $shipmentRow = $this->findLast('[data-test-shipment-row]');
+ $shipmentRow->selectFieldOption('Shipping Method', $shippingMethodName);
}
public function selectPaymentMethod(string $paymentMethodName): void
{
- $this->selectMethod('payments', 'Payment Method', $paymentMethodName, true);
+ $paymentRow = $this->addPaymentRowAndWaitForIt();
+ $paymentRow->selectFieldOption('Payment Method', $paymentMethodName);
}
public function changePaymentMethod(string $paymentMethodName): void
{
- $this->selectMethod('payments', 'Payment Method', $paymentMethodName, false);
+ $this->clickOnTab('shipping-payment');
+ $this->waitForComponentIdle();
+
+ $paymentRow = $this->findLast('[data-test-payment-row]');
+ $paymentRow->selectFieldOption('Payment Method', $paymentMethodName);
}
public function specifyQuantity(string $productVariantDescriptor, int $quantity): void
{
$item = $this->getItemWithProductSelected($productVariantDescriptor);
- $item->fillField('Quantity', $quantity);
+ $item->fillField('Quantity', (string) $quantity);
}
public function placeOrder(): void
{
- $this->getDocument()->waitFor(10, function() {
- try {
- $this->getDocument()->pressButton('Create');
-
- return true;
- } catch (Exception $exception) {
- return false;
- }
- });
-
+ $this->getDocument()->pressButton('Order preview');
}
public function selectLocale(string $localeName): void
{
- $this->clickOnTabAndWait('Locale & Currency');
+ $this->clickOnTab('locale');
- $this->getElement('locale')->selectOption($localeName);
+ $this->getDocument()->selectFieldOption('Locale', $localeName);
}
public function selectCurrency(string $currencyName): void
{
- $this->clickOnTabAndWait('Locale & Currency');
+ $this->clickOnTab('locale');
- $this->getElement('currency')->selectOption($currencyName);
+ $this->getDocument()->selectFieldOption('Currency', $currencyName);
}
public function getShippingMethodsValidationMessage(): string
{
return $this
->getDocument()
- ->find('css', '#shipmentsAndPayments .invalid-data-message')
+ ->find('css', '[data-test-shipping-methods-requirement]')
->getText()
;
}
- protected function getDefinedElements(): array
- {
- return array_merge(parent::getDefinedElements(), [
- 'billing_city' => '#sylius_admin_order_creation_new_order_billingAddress_city',
- 'billing_country' => '#sylius_admin_order_creation_new_order_billingAddress_countryCode',
- 'billing_first_name' => '#sylius_admin_order_creation_new_order_billingAddress_firstName',
- 'billing_last_name' => '#sylius_admin_order_creation_new_order_billingAddress_lastName',
- 'billing_postcode' => '#sylius_admin_order_creation_new_order_billingAddress_postcode',
- 'billing_street' => '#sylius_admin_order_creation_new_order_billingAddress_street',
- 'currency' => '#sylius_admin_order_creation_new_order_currencyCode',
- 'locale' => '#sylius_admin_order_creation_new_order_localeCode',
- 'payments' => '#sylius_admin_order_creation_new_order_payments',
- 'shipments' => '#sylius_admin_order_creation_new_order_shipments',
- 'shipping_city' => '#sylius_admin_order_creation_new_order_shippingAddress_city',
- 'shipping_country' => '#sylius_admin_order_creation_new_order_shippingAddress_countryCode',
- 'shipping_first_name' => '#sylius_admin_order_creation_new_order_shippingAddress_firstName',
- 'shipping_last_name' => '#sylius_admin_order_creation_new_order_shippingAddress_lastName',
- 'shipping_postcode' => '#sylius_admin_order_creation_new_order_shippingAddress_postcode',
- 'shipping_street' => '#sylius_admin_order_creation_new_order_shippingAddress_street',
- ]);
+ public function isAddPaymentButtonVisible(): bool
+ {
+ $this->clickOnTab('shipping-payment');
+
+ $addPaymentButton = $this->getDocument()->findButton('Add payment');
+
+ return $addPaymentButton !== null && $addPaymentButton->isVisible();
+ }
+
+ public function hasValidationErrors(): bool
+ {
+ return $this->getDocument()->has('css', '.invalid-feedback');
+ }
+
+ public function isDisplayed(): bool
+ {
+ return $this->getDocument()->findButton('Order preview') !== null;
}
private function fillAddressData(NodeElement $addressForm, AddressInterface $address): void
{
+ $countryCode = $address->getCountryCode();
+ \assert($countryCode !== null);
+
$addressForm->fillField('First name', $address->getFirstName());
$addressForm->fillField('Last name', $address->getLastName());
$addressForm->fillField('Street', $address->getStreet());
- $addressForm->fillField('Country', $address->getCountryCode());
+ $addressForm->selectFieldOption('Country', $countryCode);
$addressForm->fillField('City', $address->getCity());
$addressForm->fillField('Postcode', $address->getPostcode());
}
- private function selectMethod(string $type, string $field, string $name, bool $addNew): void
+ private function addItemAndWaitForIt(): NodeElement
+ {
+ $this->clickOnTab('items');
+ $this->waitForComponentIdle();
+
+ $itemsCount = $this->countItems();
+ $this->getDocument()->pressButton('Add item');
+
+ return $this->waitForLast('[data-test-item-row]', $itemsCount);
+ }
+
+ private function addShipmentRowAndWaitForIt(): NodeElement
{
- $this->clickOnTabAndWait('Shipments & Payments');
- $this->waitForFormToLoad();
+ $this->clickOnTab('shipping-payment');
+ $this->waitForComponentIdle();
- $collection = $this->getElement($type);
+ $shipmentsCount = $this->countShipments();
- if ($addNew) {
- $this->getDocument()->waitFor(10, function () use ($collection) {
- try {
- $collection->clickLink('Add');
+ if (0 === $shipmentsCount) {
+ $this->getDocument()->pressButton('Add shipment');
- return true;
- } catch (Exception $exception) {
- return false;
- }
- });
- $this->waitForFormToLoad();
+ return $this->waitForLast('[data-test-shipment-row]', $shipmentsCount);
}
- $this->getDocument()->waitFor(1, function () use ($collection) {
- return $collection->has('css', '[data-form-collection="item"]');
- });
+ $this->waitForComponentIdle();
- $collection->selectFieldOption($field, $name);
+ return $this->findLast('[data-test-shipment-row]');
}
- private function addItemAndWaitForIt(): NodeElement
+ private function addPaymentRowAndWaitForIt(): NodeElement
{
- $itemsCount = $this->countItems();
- $this->getDocument()->waitFor(10, function() {
- try {
- $this->getDocument()->clickLink('Add');
+ $this->clickOnTab('shipping-payment');
+ $this->waitForComponentIdle();
- return true;
- } catch (Exception $exception) {
- return false;
- }
- });
+ $paymentsCount = $this->countPayments();
+ $this->getDocument()->pressButton('Add payment');
- $this->getDocument()->waitFor(1, function () use ($itemsCount) {
- return $this->countItems() > $itemsCount;
+ return $this->waitForLast('[data-test-payment-row]', $paymentsCount);
+ }
+
+ private function waitForLast(string $cssSelector, int $previousCount): NodeElement
+ {
+ $result = $this->getDocument()->waitFor(15, function () use ($cssSelector, $previousCount) {
+ $elements = $this->getDocument()->findAll('css', $cssSelector);
+
+ return count($elements) > $previousCount ? end($elements) : null;
});
- return $this->getDocument()->find('css', '#items [data-form-collection="item"]:last-child');
+ \assert($result instanceof NodeElement);
+
+ return $result;
}
private function countItems(): int
{
- return count($this->getDocument()->findAll('css', '#items [data-form-collection="item"]'));
+ return count($this->getDocument()->findAll('css', '[data-test-item-row]'));
+ }
+
+ private function countShipments(): int
+ {
+ return count($this->getDocument()->findAll('css', '[data-test-shipment-row]'));
+ }
+
+ private function countPayments(): int
+ {
+ return count($this->getDocument()->findAll('css', '[data-test-payment-row]'));
+ }
+
+ private function waitForComponentIdle(): void
+ {
+ // Live Component debounces model updates (150ms by default) before the
+ // "busy" attribute appears, so a check right after a field change can
+ // race ahead of a request that hasn't started yet.
+ $this->getSession()->wait(300);
+
+ $this->getDocument()->waitFor(15, function () {
+ return $this->getDocument()->find('css', '[busy]') === null;
+ });
}
private function getItemWithProductSelected(string $productVariantDescriptor): NodeElement
{
- /** @var NodeElement $item */
- foreach ($this->getDocument()->findAll('css', '#items [data-form-collection="item"]') as $item) {
- $selectedProduct = $item->find('css', '.sylius-autocomplete .text')->getText();
+ $this->waitForComponentIdle();
+
+ foreach ($this->getDocument()->findAll('css', '[data-test-item-row]') as $item) {
+ $selectedOption = $this->getVariantSelect($item)->find('css', 'option[selected]');
- if (strpos($selectedProduct, $productVariantDescriptor) !== false) {
+ if ($selectedOption !== null && str_contains($selectedOption->getText(), $productVariantDescriptor)) {
return $item;
}
}
@@ -273,13 +293,25 @@ private function getItemWithProductSelected(string $productVariantDescriptor): N
throw new \InvalidArgumentException(sprintf('There is no item with product with descriptor "%s" selected', $productVariantDescriptor));
}
- private function clickOnTabAndWait(string $tabName): void
+ private function findLast(string $cssSelector): NodeElement
{
- if (!$this->getDriver() instanceof Selenium2Driver && !$this->getDriver() instanceof ChromeDriver) {
- return;
- }
+ $elements = $this->getDocument()->findAll('css', $cssSelector);
+ \assert([] !== $elements);
+
+ return end($elements);
+ }
+
+ private function getVariantSelect(NodeElement $item): NodeElement
+ {
+ $select = $item->find('css', 'select[name$="[variant]"]');
+ \assert($select !== null);
+
+ return $select;
+ }
- $tab = $this->getDocument()->find('css', sprintf('.title:contains("%s")', $tabName));
+ private function clickOnTab(string $tabName): void
+ {
+ $tab = $this->getDocument()->find('css', sprintf('[data-test-tab="%s"]', $tabName));
if ($tab->hasClass('active')) {
return;
@@ -290,24 +322,9 @@ private function clickOnTabAndWait(string $tabName): void
$this->getDocument()->waitFor(5, function () use ($tabName) {
return $this
->getDocument()
- ->find('css', sprintf('.title:contains("%s") + .content', $tabName))
+ ->find('css', sprintf('[data-test-tab="%s"]', $tabName))
->hasClass('active')
;
});
}
-
- private function waitForFormToLoad(): void
- {
- $form = $this->getDocument()->find('css', '[name="sylius_admin_order_creation_new_order"]');
- $this->getDocument()->waitFor(1000, function () use ($form) {
- return !$form->hasClass('loading');
- });
- }
-
- public function isAddPaymentButtonVisible(): bool
- {
- return
- $this->getElement('payments')->find('css', '[data-form-collection="add"]')->isVisible()
- ;
- }
}
diff --git a/tests/Behat/Element/Admin/OrderCreateFormElementInterface.php b/tests/Behat/Element/Admin/OrderCreateFormElementInterface.php
index 43de22cc5..32e23d94d 100644
--- a/tests/Behat/Element/Admin/OrderCreateFormElementInterface.php
+++ b/tests/Behat/Element/Admin/OrderCreateFormElementInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Element\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Element\Admin;
use Sylius\Component\Core\Model\AddressInterface;
@@ -44,4 +44,8 @@ public function placeOrder(): void;
public function getShippingMethodsValidationMessage(): string;
public function isAddPaymentButtonVisible(): bool;
+
+ public function hasValidationErrors(): bool;
+
+ public function isDisplayed(): bool;
}
diff --git a/tests/Behat/Element/Element.php b/tests/Behat/Element/Element.php
index 693e85167..cd20dc53d 100644
--- a/tests/Behat/Element/Element.php
+++ b/tests/Behat/Element/Element.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Element;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Element;
use Behat\Mink\Driver\DriverInterface;
use Behat\Mink\Element\DocumentElement;
@@ -15,7 +15,7 @@ abstract class Element
{
/** @var Session */
private $session;
-
+
private $parameters;
/** @var DocumentElement|null */
@@ -49,7 +49,7 @@ protected function getElement(string $name, array $parameters = []): NodeElement
$this->getSession(),
sprintf('Element named "%s" with parameters %s', $name, implode(', ', $parameters)),
'xpath',
- $element->getXpath()
+ $element->getXpath(),
);
}
@@ -88,7 +88,7 @@ private function createElement(string $name, array $parameters = []): NodeElemen
throw new \InvalidArgumentException(sprintf(
'Could not find a defined element with name "%s". The defined ones are: %s.',
$name,
- implode(', ', array_keys($definedElements))
+ implode(', ', array_keys($definedElements)),
));
}
@@ -96,7 +96,7 @@ private function createElement(string $name, array $parameters = []): NodeElemen
return new NodeElement(
$this->getSelectorAsXpath($elementSelector, $this->session->getSelectorsHandler()),
- $this->session
+ $this->session,
);
}
@@ -117,7 +117,8 @@ private function resolveParameters(string $name, array $parameters, array $defin
array_map(
function ($definedElement) use ($parameters): string {
return strtr($definedElement, $parameters);
- }, $definedElements[$name]
+ },
+ $definedElements[$name],
);
return $definedElements[$name];
diff --git a/tests/Behat/Page/Admin/NewOrderCustomerPage.php b/tests/Behat/Page/Admin/NewOrderCustomerPage.php
index 613b13b39..0920ab26f 100644
--- a/tests/Behat/Page/Admin/NewOrderCustomerPage.php
+++ b/tests/Behat/Page/Admin/NewOrderCustomerPage.php
@@ -2,27 +2,22 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
use Behat\Mink\Session;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
+use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
use Symfony\Component\Routing\RouterInterface;
-use Tests\Sylius\AdminOrderCreationPlugin\Behat\Service\AutoCompleteSelector;
final class NewOrderCustomerPage extends SymfonyPage implements NewOrderCustomerPageInterface
{
- /** @var AutoCompleteSelector */
- private $autoCompleteSelector;
-
public function __construct(
Session $session,
$parameters,
RouterInterface $router,
- AutoCompleteSelector $autoCompleteSelector
+ private readonly AutocompleteHelperInterface $autocompleteHelper,
) {
parent::__construct($session, $parameters, $router);
-
- $this->autoCompleteSelector = $autoCompleteSelector;
}
public function getRouteName(): string
@@ -32,7 +27,11 @@ public function getRouteName(): string
public function selectCustomer(string $customerEmail): void
{
- $this->autoCompleteSelector->selectOption($this->getDocument(), $customerEmail);
+ $this->autocompleteHelper->selectByName(
+ $this->getDriver(),
+ $this->getElement('customer_autocomplete')->getXpath(),
+ $customerEmail,
+ );
}
public function next(): void
@@ -48,16 +47,26 @@ public function createCustomer(string $email): void
public function selectChannel(string $channelName): void
{
- $this->getDocument()->selectFieldOption(
- 'sylius_admin_order_creation_new_order_customer_create_channel',
- $channelName
- );
+ foreach ($this->getDocument()->findAll('css', 'select[name$="[channel]"]') as $select) {
+ $select->selectOption($channelName);
+ }
}
public function hasCustomerEmailValidationMessage(string $message): bool
{
- $validationMessage = $this->getDocument()->find('css', 'form .sylius-validation-error');
+ foreach ($this->getDocument()->findAll('css', '.invalid-feedback') as $validationMessage) {
+ if (trim($validationMessage->getText()) === $message) {
+ return true;
+ }
+ }
- return $validationMessage !== null && $validationMessage->getText() === $message;
+ return false;
+ }
+
+ protected function getDefinedElements(): array
+ {
+ return array_merge(parent::getDefinedElements(), [
+ 'customer_autocomplete' => 'select[name$="[customer]"]',
+ ]);
}
}
diff --git a/tests/Behat/Page/Admin/NewOrderCustomerPageInterface.php b/tests/Behat/Page/Admin/NewOrderCustomerPageInterface.php
index baeb0ad40..ef1e0ab49 100644
--- a/tests/Behat/Page/Admin/NewOrderCustomerPageInterface.php
+++ b/tests/Behat/Page/Admin/NewOrderCustomerPageInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
interface NewOrderCustomerPageInterface
{
diff --git a/tests/Behat/Page/Admin/OrderIndexPage.php b/tests/Behat/Page/Admin/OrderIndexPage.php
index 7598be65d..831893618 100644
--- a/tests/Behat/Page/Admin/OrderIndexPage.php
+++ b/tests/Behat/Page/Admin/OrderIndexPage.php
@@ -2,30 +2,12 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
-use Behat\Mink\Session;
use Sylius\Behat\Page\Admin\Order\IndexPage;
-use Sylius\Behat\Service\Accessor\TableAccessorInterface;
-use Symfony\Component\Routing\RouterInterface;
final class OrderIndexPage extends IndexPage implements OrderIndexPageInterface
{
- /** @var TableAccessorInterface */
- private $tableAccessor;
-
- public function __construct(
- Session $session,
- $parameters,
- RouterInterface $router,
- TableAccessorInterface $tableAccessor,
- $routeName
- ) {
- parent::__construct($session, $parameters, $router, $tableAccessor, $routeName);
-
- $this->tableAccessor = $tableAccessor;
- }
-
public function createOrder(): void
{
$this->getDocument()->clickLink('Create');
diff --git a/tests/Behat/Page/Admin/OrderIndexPageInterface.php b/tests/Behat/Page/Admin/OrderIndexPageInterface.php
index 976b753a3..d01a8a7f4 100644
--- a/tests/Behat/Page/Admin/OrderIndexPageInterface.php
+++ b/tests/Behat/Page/Admin/OrderIndexPageInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
use Sylius\Behat\Page\Admin\Order\IndexPageInterface;
diff --git a/tests/Behat/Page/Admin/OrderPreviewPage.php b/tests/Behat/Page/Admin/OrderPreviewPage.php
index 6f2eacd1b..ad503fd6e 100644
--- a/tests/Behat/Page/Admin/OrderPreviewPage.php
+++ b/tests/Behat/Page/Admin/OrderPreviewPage.php
@@ -2,11 +2,8 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
-use Behat\Mink\Driver\Selenium2Driver;
-use Behat\Mink\Element\NodeElement;
-use DMore\ChromeDriver\ChromeDriver;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
final class OrderPreviewPage extends SymfonyPage implements OrderPreviewPageInterface
@@ -18,12 +15,12 @@ public function getRouteName(): string
public function getTotal(): string
{
- return str_replace('Order total: ', '', $this->getDocument()->find('css', 'td#total')->getText());
+ return trim($this->getDocument()->find('css', 'td#total')->getText());
}
public function getShippingTotal(): string
{
- return str_replace('Shipping total: ', '', $this->getDocument()->find('css', 'td#shipping-total')->getText());
+ return trim($this->getDocument()->find('css', 'td#shipping-total')->getText());
}
public function hasProduct(string $productName): bool
@@ -43,85 +40,79 @@ public function hasConfirmButton(): bool
public function hasOrderDiscountValidationMessage(string $message): bool
{
- $orderDiscountValidationMessage = $this
+ $validationMessage = $this
->getDocument()
- ->find('css', '#sylius_admin_order_creation_new_order_adjustments .sylius-validation-error')
+ ->find('css', '[data-test-order-discount] .invalid-feedback')
;
- return
- $orderDiscountValidationMessage !== null &&
- $orderDiscountValidationMessage->getText() === $message
- ;
+ return $validationMessage !== null && trim($validationMessage->getText()) === $message;
}
public function hasItemDiscountValidationMessage(string $productCode, string $message): bool
{
- $item = $this->getDocument()->find('css', sprintf('table tr:contains("%s") + tr', $productCode));
+ $row = $this->getDocument()->find('css', sprintf('[data-test-item]:contains("%s")', $productCode));
+
+ if ($row === null) {
+ return false;
+ }
+
+ $validationMessage = $row->find('css', '[data-test-item-discount] .invalid-feedback');
- return null !== $item->find('css', sprintf('.sylius-validation-error:contains("%s")', $message));
+ return $validationMessage !== null && trim($validationMessage->getText()) === $message;
}
public function hasLocale(string $localeName): bool
{
- /** @var NodeElement $localeElement */
$localeElement = $this->getDocument()->find('css', '#sylius-order-locale-code');
- return strpos($localeElement->getText(), $localeName) !== false;
+ return $localeElement !== null && strpos($localeElement->getText(), $localeName) !== false;
}
public function hasCurrency(string $currencyName): bool
{
- /** @var NodeElement $localeElement */
- $localeElement = $this->getDocument()->find('css', '#sylius-order-currency');
+ $currencyElement = $this->getDocument()->find('css', '#sylius-order-currency');
- return strpos($localeElement->getText(), $currencyName) !== false;
+ return $currencyElement !== null && strpos($currencyElement->getText(), $currencyName) !== false;
}
public function lowerOrderPriceBy(string $discount): void
{
- $discountCollection = $this->getDocument()->find('css', '#sylius_admin_order_creation_new_order_adjustments');
+ $discountCard = $this->getDocument()->find('css', '[data-test-order-discount]');
+ \assert($discountCard !== null);
+ $discountCard->pressButton('Add discount');
- $discountCollection->clickLink('Add discount');
- $this->getDocument()->waitFor(1, function () use ($discountCollection) {
- return $discountCollection->has('css', '[data-form-collection="item"]');
+ $this->getDocument()->waitFor(5, function () use ($discountCard) {
+ return $discountCard->hasField('Order discount');
});
- $discountCollection->fillField('Order discount', $discount);
+ $discountCard->fillField('Order discount', $discount);
}
public function lowerItemWithProductPriceBy(string $productCode, string $discount): void
{
- $item = $this->getDocument()->find('css', sprintf('table tr:contains("%s") + tr', $productCode));
- $item->clickLink('Add discount');
+ $row = $this->getDocument()->find('css', sprintf('[data-test-item]:contains("%s")', $productCode));
+ \assert($row !== null);
+ $row->pressButton('Add discount');
- $discountCollection = $item->find('css', '[data-form-type="collection"]');
-
- $this->getDocument()->waitFor(1, function () use ($discountCollection) {
- return $discountCollection->has('css', '[data-form-collection="item"]');
+ $this->getDocument()->waitFor(5, function () use ($row) {
+ return $row->hasField('Item discount');
});
- $discountCollection->fillField('Item discount', $discount);
+ $row->fillField('Item discount', $discount);
}
- public function confirm(): void
+ public function checkSendPaymentLinkEmail(): void
{
- $confirmButton = $this->getDocument()->findButton('Confirm');
-
- if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
- $confirmButton->focus();
- }
+ $this->getDocument()->checkField('Send a payment link to the customer via email');
+ }
- $confirmButton->press();
+ public function confirm(): void
+ {
+ $this->getDocument()->pressButton('Confirm');
}
public function goBack(): void
{
- $backButton = $this->getDocument()->findButton('Back');
-
- if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
- $backButton->focus();
- }
-
- $backButton->press();
+ $this->getDocument()->pressButton('Back');
}
}
diff --git a/tests/Behat/Page/Admin/OrderPreviewPageInterface.php b/tests/Behat/Page/Admin/OrderPreviewPageInterface.php
index d93390f6a..838829385 100644
--- a/tests/Behat/Page/Admin/OrderPreviewPageInterface.php
+++ b/tests/Behat/Page/Admin/OrderPreviewPageInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
interface OrderPreviewPageInterface
{
@@ -28,6 +28,8 @@ public function lowerOrderPriceBy(string $discount): void;
public function lowerItemWithProductPriceBy(string $productCode, string $discount): void;
+ public function checkSendPaymentLinkEmail(): void;
+
public function confirm(): void;
public function goBack(): void;
diff --git a/tests/Behat/Page/Admin/OrderShowPage.php b/tests/Behat/Page/Admin/OrderShowPage.php
index 242caf0ef..89f30ccca 100644
--- a/tests/Behat/Page/Admin/OrderShowPage.php
+++ b/tests/Behat/Page/Admin/OrderShowPage.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
use Sylius\Behat\Page\Admin\Order\ShowPage;
@@ -10,20 +10,24 @@ final class OrderShowPage extends ShowPage implements OrderShowPageInterface
{
public function hasPaymentLink(): bool
{
- $lastPayment = $this->getElement('payments')->find('css', '.item:last-child');
+ $lastPayment = $this->getElement('payments')->find('css', '[data-test-payment]:last-child');
- return null !== $lastPayment->find('css', '#payment-link');
+ if (null === $lastPayment) {
+ return false;
+ }
+
+ return null !== $lastPayment->find('css', '[data-test-pay-via-payment-link]');
}
public function hasNoPaymentBlock(): bool
{
- return null !== $this->getElement('no-payments');
+ return null !== $this->getDocument()->find('css', $this->getDefinedElements()['no-payments']);
}
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
- 'no-payments' => '#no-payments',
+ 'no-payments' => '[data-test-no-payments]',
]);
}
}
diff --git a/tests/Behat/Page/Admin/OrderShowPageInterface.php b/tests/Behat/Page/Admin/OrderShowPageInterface.php
index de91651f7..61cb58ea9 100644
--- a/tests/Behat/Page/Admin/OrderShowPageInterface.php
+++ b/tests/Behat/Page/Admin/OrderShowPageInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
use Sylius\Behat\Page\Admin\Order\ShowPageInterface;
diff --git a/tests/Behat/Page/Admin/ReorderPage.php b/tests/Behat/Page/Admin/ReorderPage.php
index 26078b67a..eee5cf379 100644
--- a/tests/Behat/Page/Admin/ReorderPage.php
+++ b/tests/Behat/Page/Admin/ReorderPage.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
diff --git a/tests/Behat/Page/Admin/ReorderPageInterface.php b/tests/Behat/Page/Admin/ReorderPageInterface.php
index 2a5598b6c..07e52b55e 100644
--- a/tests/Behat/Page/Admin/ReorderPageInterface.php
+++ b/tests/Behat/Page/Admin/ReorderPageInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Behat\Page\Admin;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Page\Admin;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPageInterface;
diff --git a/tests/Behat/Resources/services.xml b/tests/Behat/Resources/services.xml
index 015d4763f..afe8f901b 100644
--- a/tests/Behat/Resources/services.xml
+++ b/tests/Behat/Resources/services.xml
@@ -4,35 +4,39 @@
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
diff --git a/tests/Behat/Resources/suites/admin_reordering.yml b/tests/Behat/Resources/suites/admin_reordering.yml
index 3fba425e8..9333c3ad0 100644
--- a/tests/Behat/Resources/suites/admin_reordering.yml
+++ b/tests/Behat/Resources/suites/admin_reordering.yml
@@ -3,7 +3,7 @@ default:
ui_admin_order_creation_admin_reordering:
contexts:
- sylius.behat.context.hook.doctrine_orm
- - sylius.behat.context.hook.email_spool
+ - sylius.behat.context.hook.mailer
- sylius.behat.context.setup.admin_security
- sylius.behat.context.setup.admin_user
@@ -36,6 +36,7 @@ default:
- sylius.behat.context.ui.channel
- sylius.behat.context.ui.email
- - Tests\Sylius\AdminOrderCreationPlugin\Behat\Context\Admin\ManagingOrdersContext
+ - Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Context\Admin\ManagingOrdersContext
+ - Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Context\Setup\PaymentContext
filters:
tags: "@admin_order_creation_admin_reordering && @ui"
diff --git a/tests/Behat/Resources/suites/managing_orders.yml b/tests/Behat/Resources/suites/managing_orders.yml
index 04061b6b2..6e38429cd 100644
--- a/tests/Behat/Resources/suites/managing_orders.yml
+++ b/tests/Behat/Resources/suites/managing_orders.yml
@@ -3,7 +3,7 @@ default:
ui_admin_order_creation_managing_orders:
contexts:
- sylius.behat.context.hook.doctrine_orm
- - sylius.behat.context.hook.email_spool
+ - sylius.behat.context.hook.mailer
- sylius.behat.context.setup.admin_security
- sylius.behat.context.setup.admin_user
@@ -54,6 +54,7 @@ default:
- sylius.behat.context.ui.shop.checkout.complete
- sylius.behat.context.ui.shop.currency
- - Tests\Sylius\AdminOrderCreationPlugin\Behat\Context\Admin\ManagingOrdersContext
+ - Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Context\Admin\ManagingOrdersContext
+ - Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Behat\Context\Setup\PaymentContext
filters:
tags: "@admin_order_creation_managing_orders && @ui"
diff --git a/tests/Behat/Service/AutoCompleteSelector.php b/tests/Behat/Service/AutoCompleteSelector.php
deleted file mode 100644
index 8b9b0fd60..000000000
--- a/tests/Behat/Service/AutoCompleteSelector.php
+++ /dev/null
@@ -1,45 +0,0 @@
-waitForItemsToLoad($scope);
-
- $scope->waitFor(10, function () use ($scope, $optionName) {
- try {
- $scope->find('css', sprintf('.sylius-autocomplete .menu .item:contains("%s")', $optionName))->click();
-
- return true;
- } catch (FatalThrowableError $exception) {
- return false;
- }
- });
- }
-
- public function areItemsVisible(ElementInterface $scope): bool
- {
- $this->waitForItemsToLoad($scope);
-
- return strpos($scope->find('css', '.sylius-autocomplete .menu')->getText(), 'No results found') !== false;
- }
-
- private function waitForItemsToLoad(ElementInterface $scope): void
- {
- $scope->find('css', '.sylius-autocomplete .icon')->click();
-
- $scope->waitFor(10, function() use ($scope) {
- return $scope
- ->find('css', '.sylius-autocomplete .menu')
- ->hasClass('visible')
- ;
- });
- }
-}
diff --git a/tests/Application/src/Migrations/.gitkeep b/tests/Functional/.gitkeep
similarity index 100%
rename from tests/Application/src/Migrations/.gitkeep
rename to tests/Functional/.gitkeep
diff --git a/tests/Application/var/.gitkeep b/tests/Integration/.gitkeep
similarity index 100%
rename from tests/Application/var/.gitkeep
rename to tests/Integration/.gitkeep
diff --git a/tests/Integration/DependencyInjection/OrderFactoryServiceWiringTest.php b/tests/Integration/DependencyInjection/OrderFactoryServiceWiringTest.php
new file mode 100644
index 000000000..d9b54e9a5
--- /dev/null
+++ b/tests/Integration/DependencyInjection/OrderFactoryServiceWiringTest.php
@@ -0,0 +1,23 @@
+getContainer();
+
+ $orderFactory = $container->get(OrderFactoryInterface::class);
+
+ self::assertInstanceOf(OrderFactoryInterface::class, $orderFactory);
+ }
+}
diff --git a/tests/TestApplication/.env b/tests/TestApplication/.env
new file mode 100644
index 000000000..2d764e838
--- /dev/null
+++ b/tests/TestApplication/.env
@@ -0,0 +1,8 @@
+DATABASE_URL=mysql://root@127.0.0.1/sylius_admin_order_creation_plugin_%kernel.environment%
+
+BEHAT_BASE_URL="https://127.0.0.1:8080/"
+BEHAT_CHROME_URL="http://127.0.0.1:9222"
+
+SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php"
+SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="@WebgriffeSyliusAdminOrderCreationPlugin/tests/TestApplication/config/config.yaml"
+SYLIUS_TEST_APP_ROUTES_TO_IMPORT="@WebgriffeSyliusAdminOrderCreationPlugin/tests/TestApplication/config/routes.yaml"
diff --git a/tests/TestApplication/.env.test b/tests/TestApplication/.env.test
new file mode 100644
index 000000000..81ecc6533
--- /dev/null
+++ b/tests/TestApplication/.env.test
@@ -0,0 +1 @@
+DATABASE_URL=mysql://root@127.0.0.1/sylius_admin_order_creation_plugin_%kernel.environment%
diff --git a/tests/TestApplication/config/bundles.php b/tests/TestApplication/config/bundles.php
new file mode 100644
index 000000000..21325d35f
--- /dev/null
+++ b/tests/TestApplication/config/bundles.php
@@ -0,0 +1,7 @@
+ ['all' => true],
+];
diff --git a/tests/TestApplication/config/config.yaml b/tests/TestApplication/config/config.yaml
new file mode 100644
index 000000000..9f6f528b1
--- /dev/null
+++ b/tests/TestApplication/config/config.yaml
@@ -0,0 +1,16 @@
+imports:
+ - { resource: "packages/*.yaml" }
+ - { resource: "@WebgriffeSyliusAdminOrderCreationPlugin/config/config.yaml" }
+ - { resource: "services_test.php" }
+
+sylius_customer:
+ resources:
+ customer:
+ classes:
+ repository: Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Repository\CustomerRepository
+
+sylius_product:
+ resources:
+ product_variant:
+ classes:
+ repository: Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Repository\ProductVariantRepository
diff --git a/tests/TestApplication/config/packages/monolog.yaml b/tests/TestApplication/config/packages/monolog.yaml
new file mode 100644
index 000000000..62e6ab019
--- /dev/null
+++ b/tests/TestApplication/config/packages/monolog.yaml
@@ -0,0 +1,10 @@
+when@dev:
+ monolog:
+ handlers:
+ main:
+ type: stream
+ path: "%kernel.logs_dir%/%kernel.environment%.log"
+ level: warning
+ firephp:
+ type: firephp
+ level: info
diff --git a/tests/TestApplication/config/routes.yaml b/tests/TestApplication/config/routes.yaml
new file mode 100644
index 000000000..92612b9b5
--- /dev/null
+++ b/tests/TestApplication/config/routes.yaml
@@ -0,0 +1,2 @@
+sylius_admin_order_creation_plugin:
+ resource: "@WebgriffeSyliusAdminOrderCreationPlugin/config/routing.yaml"
diff --git a/tests/TestApplication/config/services_test.php b/tests/TestApplication/config/services_test.php
new file mode 100644
index 000000000..ced5c42b7
--- /dev/null
+++ b/tests/TestApplication/config/services_test.php
@@ -0,0 +1,12 @@
+env(), 'test')) {
+ $container->import('../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml');
+ $container->import('@WebgriffeSyliusAdminOrderCreationPlugin/tests/Behat/Resources/services.xml');
+ }
+};
diff --git a/tests/Application/Doctrine/ORM/CustomerRepository.php b/tests/TestApplication/src/Repository/CustomerRepository.php
similarity index 52%
rename from tests/Application/Doctrine/ORM/CustomerRepository.php
rename to tests/TestApplication/src/Repository/CustomerRepository.php
index 77d7b6d6b..12c674c71 100644
--- a/tests/Application/Doctrine/ORM/CustomerRepository.php
+++ b/tests/TestApplication/src/Repository/CustomerRepository.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Application\Doctrine\ORM;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Repository;
-use Sylius\AdminOrderCreationPlugin\Doctrine\ORM\CustomerRepositoryInterface;
-use Sylius\AdminOrderCreationPlugin\Doctrine\ORM\CustomerRepositoryTrait;
+use Webgriffe\SyliusAdminOrderCreationPlugin\Doctrine\ORM\CustomerRepositoryInterface;
+use Webgriffe\SyliusAdminOrderCreationPlugin\Doctrine\ORM\CustomerRepositoryTrait;
use Sylius\Bundle\CoreBundle\Doctrine\ORM\CustomerRepository as BaseCustomerRepository;
final class CustomerRepository extends BaseCustomerRepository implements CustomerRepositoryInterface
diff --git a/tests/Application/Doctrine/ORM/ProductVariantRepository.php b/tests/TestApplication/src/Repository/ProductVariantRepository.php
similarity index 54%
rename from tests/Application/Doctrine/ORM/ProductVariantRepository.php
rename to tests/TestApplication/src/Repository/ProductVariantRepository.php
index a7719f127..27a00a6cc 100644
--- a/tests/Application/Doctrine/ORM/ProductVariantRepository.php
+++ b/tests/TestApplication/src/Repository/ProductVariantRepository.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace Tests\Sylius\AdminOrderCreationPlugin\Application\Doctrine\ORM;
+namespace Tests\Webgriffe\SyliusAdminOrderCreationPlugin\Repository;
-use Sylius\AdminOrderCreationPlugin\Doctrine\ORM\ProductVariantRepositoryInterface;
-use Sylius\AdminOrderCreationPlugin\Doctrine\ORM\ProductVariantRepositoryTrait;
+use Webgriffe\SyliusAdminOrderCreationPlugin\Doctrine\ORM\ProductVariantRepositoryInterface;
+use Webgriffe\SyliusAdminOrderCreationPlugin\Doctrine\ORM\ProductVariantRepositoryTrait;
use Sylius\Bundle\CoreBundle\Doctrine\ORM\ProductVariantRepository as BaseProductVariantRepository;
final class ProductVariantRepository extends BaseProductVariantRepository implements ProductVariantRepositoryInterface
diff --git a/tests/Application/translations/.gitignore b/tests/Unit/.gitkeep
similarity index 100%
rename from tests/Application/translations/.gitignore
rename to tests/Unit/.gitkeep
diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php
new file mode 100644
index 000000000..35b62aa9f
--- /dev/null
+++ b/tests/Unit/DependencyInjection/ConfigurationTest.php
@@ -0,0 +1,44 @@
+processConfiguration(new Configuration(), []);
+
+ self::assertSame(['offline'], $processedConfiguration['offline_gateway_names']);
+ }
+
+ public function testItAllowsConfiguringCustomOfflineGatewayNames(): void
+ {
+ $processedConfiguration = (new Processor())->processConfiguration(new Configuration(), [
+ ['offline_gateway_names' => ['offline', 'bank_transfer']],
+ ]);
+
+ self::assertSame(['offline', 'bank_transfer'], $processedConfiguration['offline_gateway_names']);
+ }
+
+ public function testItDefaultsPaymentLinkGenerationToEnabled(): void
+ {
+ $processedConfiguration = (new Processor())->processConfiguration(new Configuration(), []);
+
+ self::assertTrue($processedConfiguration['payment_link_generation_enabled']);
+ }
+
+ public function testItAllowsDisablingPaymentLinkGeneration(): void
+ {
+ $processedConfiguration = (new Processor())->processConfiguration(new Configuration(), [
+ ['payment_link_generation_enabled' => false],
+ ]);
+
+ self::assertFalse($processedConfiguration['payment_link_generation_enabled']);
+ }
+}
diff --git a/src/Resources/translations/messages.de.yml b/translations/messages.de.yaml
similarity index 100%
rename from src/Resources/translations/messages.de.yml
rename to translations/messages.de.yaml
diff --git a/src/Resources/translations/messages.en.yml b/translations/messages.en.yaml
similarity index 76%
rename from src/Resources/translations/messages.en.yml
rename to translations/messages.en.yaml
index 4dbb17792..63a4bf3d8 100644
--- a/src/Resources/translations/messages.en.yml
+++ b/translations/messages.en.yaml
@@ -8,14 +8,21 @@ sylius_admin_order_creation:
order_price: 'Order price'
ui:
add_discount: 'Add discount'
+ add_item: 'Add item'
+ add_payment: 'Add payment'
+ add_shipment: 'Add shipment'
confirm: 'Confirm'
create_new: 'Create new'
customer_email: 'Customer email cannot be empty'
customer_selection: 'Customer selection'
+ existing_customer: 'Existing customer'
item_discount: 'Item discount'
new_customer_email: 'New customer email'
no_customer_selected: "You haven't selected a customer"
+ no_discount: 'No discount applied'
order_discount: 'Order discount'
order_preview: 'Order preview'
+ pay: 'Pay'
reorder: 'Reorder'
+ send_payment_link_email: 'Send a payment link to the customer via email'
shipping_methods_selection_requirement: 'You need to add some items and shipping address to select from eligible shipping method'
diff --git a/src/Resources/translations/messages.fr.yml b/translations/messages.fr.yaml
similarity index 100%
rename from src/Resources/translations/messages.fr.yml
rename to translations/messages.fr.yaml
diff --git a/src/Resources/translations/messages.ru.yml b/translations/messages.ru.yaml
similarity index 100%
rename from src/Resources/translations/messages.ru.yml
rename to translations/messages.ru.yaml
diff --git a/src/Resources/translations/validators.de.yml b/translations/validators.de.yaml
similarity index 71%
rename from src/Resources/translations/validators.de.yml
rename to translations/validators.de.yaml
index d1af7ea58..8c1d8c003 100644
--- a/src/Resources/translations/validators.de.yml
+++ b/translations/validators.de.yaml
@@ -1,3 +1,4 @@
sylius_admin_order_creation:
order_discount: 'Der Rabatt kann nicht unter 0 liegen'
customer_email: 'Die E-Mail Adresse des Kunden darf nicht leer sein'
+ no_customer_selected: 'Sie haben keinen Kunden ausgewählt'
diff --git a/src/Resources/translations/validators.en.yml b/translations/validators.en.yaml
similarity index 68%
rename from src/Resources/translations/validators.en.yml
rename to translations/validators.en.yaml
index 4cf738657..5acdad121 100644
--- a/src/Resources/translations/validators.en.yml
+++ b/translations/validators.en.yaml
@@ -1,3 +1,4 @@
sylius_admin_order_creation:
order_discount: 'Discount cannot be below 0'
customer_email: 'Customer email cannot be empty'
+ no_customer_selected: "You haven't selected a customer"
diff --git a/src/Resources/translations/validators.fr.yml b/translations/validators.fr.yaml
similarity index 71%
rename from src/Resources/translations/validators.fr.yml
rename to translations/validators.fr.yaml
index e7425c39d..6b6dcd7b6 100644
--- a/src/Resources/translations/validators.fr.yml
+++ b/translations/validators.fr.yaml
@@ -1,3 +1,4 @@
sylius_admin_order_creation:
order_discount: La réduction ne peut pas être inférieure à zéro
customer_email: L'email du client ne peut pas être vide
+ no_customer_selected: Vous n'avez sélectionné aucun client
diff --git a/src/Resources/translations/validators.ru.yml b/translations/validators.ru.yaml
similarity index 100%
rename from src/Resources/translations/validators.ru.yml
rename to translations/validators.ru.yaml