Skip to content

Commit

Permalink
Change from xml to php tests service definition
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Oct 2, 2024
1 parent 7471b30 commit e09295e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 28 deletions.
2 changes: 1 addition & 1 deletion tests/Application/config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ webgriffe_sylius_clerk_shop:
resource: "@WebgriffeSyliusClerkPlugin/config/shop_routing.php"
prefix: /{_locale}
requirements:
_locale: ^[a-z]{2}(?:_[A-Z]{2})?$
_locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$

webgriffe_sylius_clerk_feed:
resource: "@WebgriffeSyliusClerkPlugin/config/feed_routing.php"
2 changes: 1 addition & 1 deletion tests/Application/config/services_test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
imports:
- { resource: "../../Behat/Resources/services.xml" }
- { resource: "../../Behat/Resources/services.php" }
- { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" }

# workaround needed for strange "test.client.history" problem
Expand Down
46 changes: 46 additions & 0 deletions tests/Behat/Resources/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Tests\Webgriffe\SyliusClerkPlugin\Behat\Context\Api\ClerkFeedContext;
use Tests\Webgriffe\SyliusClerkPlugin\Behat\Context\Setup\ProductContext;
use Tests\Webgriffe\SyliusClerkPlugin\Behat\Context\Shop\ClerkSalesTrackingContext;
use Tests\Webgriffe\SyliusClerkPlugin\Behat\Context\Shop\ClerkTrackingCodeContext;
use Tests\Webgriffe\SyliusClerkPlugin\Behat\Page\Shop\ThankYouPage;

return static function (ContainerConfigurator $containerConfigurator) {
$services = $containerConfigurator->services();
$services->defaults()->public();

$services->set(ClerkFeedContext::class)
->args([
service('test.client'),
])
;

$services->set(ProductContext::class)
->args([
service('doctrine.orm.entity_manager'),
service('sylius.product_variant_resolver.default'),
])
;

$services->set(ClerkTrackingCodeContext::class)
->args([
service('sylius.behat.page.shop.home'),
])
;

$services->set(ClerkSalesTrackingContext::class)
->args([
service(ThankYouPage::class),
])
;

$services->set(ThankYouPage::class)
->parent('sylius.behat.page.shop.order.thank_you')
->private()
;
};
26 changes: 0 additions & 26 deletions tests/Behat/Resources/services.xml

This file was deleted.

0 comments on commit e09295e

Please sign in to comment.