sylius-labs / sylius-1-11-shim-bundle
Adds some functionalities from Sylius 1.11 to Sylius 1.12 and above
Installs: 91 154
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.0
- sylius/sylius: ^1.10
- symfony/browser-kit: ^5.4|^6.0
Requires (Dev)
- phpunit/phpunit: ^9.5
README
âī¸ Installation
-
Require the bundle with composer:
$ composer require sylius-labs/sylius-1-11-shim-bundle --dev
-
Add the bundle to your
config/bundles.php
file:<?php return [ // ... SyliusLabs\Sylius111ShimBundle\SyliusLabsSylius111ShimBundle::class => ['test' => true, 'test_cached' => true], ];
đ Usage
Legacy Behat API Platform client
Sylius 1.12 came with a refactored API Platform client for Behat tests. This may lead to harder supporting of Sylius 1.11 and 1.12 in the same time. To make it easier, we've created a legacy client that can be used in plugins supporting Sylius 1.11 and 1.12.
âšī¸
Sylius1_11\Behat\Client\*
classes are suitable for both 1.12 and earlier versions of Sylius.
- For
1.11
and earlier compatibility, usesylius.behat.api_platform_client.legacy
insteadsylius.behat.api_platform_client
- All
1.11
and earliersylius.behat.api_platform_client.*
services are again available to use Sylius\Behat\Client\ApiClientInterface
from Sylius 1.12 became incompatible withSylius\Behat\Client\ApiClientInterface
from Sylius 1.11 and earlier. To make it compatible, useSylius1_11\Behat\Client\ApiClientInterface
insteadSylius\Behat\Client\ApiPlatformClient
from Sylius 1.12 became incompatible withSylius\Behat\Client\ApiPlatformClient
from Sylius 1.11 and earlier. To make it compatible, useSylius1_11\Behat\Client\ApiPlatformClient
insteadSylius\Behat\Client\RequestInterface
from Sylius 1.12 became incompatible withSylius\Behat\Client\RequestInterface
from Sylius 1.11 and earlier. To make it compatible, useSylius1_11\Behat\Client\RequestInterface
insteadSylius\Behat\Client\Request
from Sylius 1.12 became incompatible withSylius\Behat\Client\Request
from Sylius 1.11 and earlier. To make it compatible, useSylius1_11\Behat\Client\Request
instead
Restore sylius.behat.context.hook.email_spool
service
sylius.behat.context.hook.email_spool
has been replace by sylius.behat.context.hook.mailer
. This shim adds an alias pointing the old name to the new one.
đ Examples
Already using one of services with changed signatures.
Just replace Sylius
with Sylius1_11
. All services with changed signatures has been aliased to this scheme of naming.
use Behat\Behat\Context\Context; -use Sylius\Behat\Client\ApiClientInterface; use Sylius\Behat\Client\ResponseCheckerInterface; use Sylius\Behat\Service\SharedStorageInterface; use Sylius\LoyaltyPlugin\Domain\Model\CustomerInterface; +use Sylius1_11\Behat\Client\ApiClientInterface; use Webmozart\Assert\Assert; final class ManagingLoyaltyContext implements Context { public function __construct( private ApiClientInterface $apiAdminClient, private SharedStorageInterface $sharedStorage, private ResponseCheckerInterface $responseChecker, ) { }
Having an API Client for a custom resource
Replace sylius.behat.api_platform_client
parent declaration with sylius.behat.api_platform_client.legacy
and Sylius\Behat\Client\ApiPlatformClient
class with Sylius1_11\Behat\Client\ApiPlatformClient
.
-<service id="app.behat.api_platform_client.admin.points" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client"> +<service id="app.behat.api_platform_client.admin.points" class="Sylius1_11\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client.legacy"> <argument>loyalty-points-accounts</argument> <argument>admin</argument> </service>