diff --git a/tests/Behat/Resources/services.php b/tests/Behat/Resources/services.php new file mode 100644 index 000000000..9d79cfc0b --- /dev/null +++ b/tests/Behat/Resources/services.php @@ -0,0 +1,165 @@ +services(); + $parameters = $container->parameters(); + $parameters->set('sylius.behat.page.admin.order.show.class', ShowPage::class); + $parameters->set('sylius.behat.page.shop.order.show.class', \Tests\Sylius\RefundPlugin\Behat\Page\Shop\Order\ShowPage::class); + + $services->defaults() + ->public(); + + $services->set(OrderRefundsPage::class) + ->parent('sylius.behat.symfony_page'); + + $services->set(CreditMemoDetailsPage::class) + ->parent('sylius.behat.symfony_page') + ->args([service('sylius.behat.table_accessor')]); + + $services->set(CreditMemoIndexPage::class) + ->parent('sylius.behat.page.admin.crud.index') + ->args(['sylius_refund_admin_credit_memo_index']); + + $services->set(Element::class) + ->private() + ->abstract() + ->args([ + service('behat.mink.default_session'), + service('behat.mink.parameters'), + ]); + + $services->set(PdfDownloadElement::class) + ->private() + ->parent(Element::class); + + $services->set(RefundingContext::class) + ->args([ + service('sylius.repository.order'), + service('sylius_refund.repository.refund'), + service('sylius_refund.provider.remaining_total'), + service('sylius.command_bus'), + service('sylius.behat.email_checker'), + ]); + + $services->set(CreditMemoContext::class) + ->args([ + service('sylius_refund.repository.credit_memo'), + service('sylius_refund.provider.current_date_time_immutable'), + '%sylius_refund.credit_memo_save_path%', + ]); + + $services->set(ManagingOrdersContext::class) + ->args([ + service('sylius.behat.page.admin.order.show'), + service('sylius.behat.page.admin.order.index'), + service('sylius.behat.notification_checker.shop'), + ]); + + $services->set(\Tests\Sylius\RefundPlugin\Behat\Context\Ui\RefundingContext::class) + ->args([ + service(OrderRefundsPage::class), + service('sylius.behat.notification_checker.admin'), + service('sylius.behat.email_checker'), + ]); + + $services->set(\Tests\Sylius\RefundPlugin\Behat\Context\Ui\CreditMemoContext::class) + ->args([ + service('sylius.behat.page.admin.order.show'), + service(CreditMemoIndexPage::class), + service(CreditMemoDetailsPage::class), + service(PdfDownloadElement::class), + service('sylius_refund.repository.credit_memo'), + service('sylius_refund.provider.current_date_time_immutable'), + ]); + + $services->set(\Tests\Sylius\RefundPlugin\Behat\Context\Setup\RefundingContext::class) + ->args([ + service('sylius.repository.order'), + service('sylius.command_bus'), + service(FailedCreditMemoGenerator::class), + service(FailedRefundPaymentFactory::class), + ]); + + $services->set(OrderContext::class) + ->args([ + service('sylius.manager.order'), + service('sylius.behat.shared_storage'), + service('sylius_abstraction.state_machine'), + ]); + + $services->set(PaymentContext::class) + ->args([ + service('sylius_abstraction.state_machine'), + service('sylius.behat.shared_storage'), + ]); + + $services->set(\Tests\Sylius\RefundPlugin\Behat\Context\Transform\OrderContext::class) + ->args([service('sylius.repository.order')]); + + $services->set(PriceContext::class); + + $services->set(\Tests\Sylius\RefundPlugin\Behat\Context\Ui\Shop\Customer\CreditMemoContext::class) + ->args([ + service('sylius.behat.page.shop.order.show'), + service(PdfDownloadElement::class), + ]); + + $services->set(ChannelContext::class) + ->args([ + service('sylius.behat.shared_storage'), + service('sylius.behat.factory.default_united_states_channel'), + service('sylius.behat.factory.default_channel'), + service('sylius.manager.channel'), + ]); + + $services->set(EmailsContext::class) + ->args([service('sylius.behat.email_checker')]); + + $services->set(ProductContext::class) + ->args([service('sylius.behat.context.setup.product')]); + + $services->set(CreditMemosContext::class) + ->args(['%sylius_refund.credit_memo_save_path%']); + + $services->set(FailedRefundPaymentFactory::class) + ->private() + ->decorate('sylius_refund.factory.refund_payment') + ->args([service('.inner')]); + + $services->set(FailedCreditMemoGenerator::class) + ->private() + ->decorate('sylius_refund.generator.credit_memo') + ->args([service('.inner')]); +}; diff --git a/tests/Behat/Resources/services.xml b/tests/Behat/Resources/services.xml deleted file mode 100644 index 579220efe..000000000 --- a/tests/Behat/Resources/services.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - Tests\Sylius\RefundPlugin\Behat\Page\Admin\Order\ShowPage - Tests\Sylius\RefundPlugin\Behat\Page\Shop\Order\ShowPage - - - - - - - - - - - sylius_refund_admin_credit_memo_index - - - - - - - - - - - - - - - - - - - - %sylius_refund.credit_memo_save_path% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %sylius_refund.credit_memo_save_path% - - - - - - - - - - - diff --git a/tests/TestApplication/config/services_test.php b/tests/TestApplication/config/services_test.php index 516df18fc..031158122 100644 --- a/tests/TestApplication/config/services_test.php +++ b/tests/TestApplication/config/services_test.php @@ -9,7 +9,7 @@ if (str_starts_with($env, 'test')) { $container->import('../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml'); - $container->import('@SyliusRefundPlugin/tests/Behat/Resources/services.xml'); + $container->import('@SyliusRefundPlugin/tests/Behat/Resources/services.php'); } if (filter_var($_ENV['TEST_SYLIUS_REFUND_PDF_GENERATION_DISABLED'], FILTER_VALIDATE_BOOLEAN)) {