Skip to content

Commit 12476ac

Browse files
authored
Add examples to README.md
1 parent e0f923e commit 12476ac

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,40 @@ To make it easier, we've created a legacy client that can be used in plugins sup
3737
3838
### Restore `sylius.behat.context.hook.email_spool` service
3939
`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.
40+
41+
## 📝 Examples
42+
43+
### Already using one of services with changed signatures.
44+
45+
Just replace `Sylius` with `Sylius1_11`. All services with changed signatures has been aliased to this scheme of naming.
46+
47+
```diff
48+
use Behat\Behat\Context\Context;
49+
-use Sylius\Behat\Client\ApiClientInterface;
50+
use Sylius\Behat\Client\ResponseCheckerInterface;
51+
use Sylius\Behat\Service\SharedStorageInterface;
52+
use Sylius\LoyaltyPlugin\Domain\Model\CustomerInterface;
53+
+use Sylius1_11\Behat\Client\ApiClientInterface;
54+
use Webmozart\Assert\Assert;
55+
56+
final class ManagingLoyaltyContext implements Context
57+
{
58+
public function __construct(
59+
private ApiClientInterface $apiAdminClient,
60+
private SharedStorageInterface $sharedStorage,
61+
private ResponseCheckerInterface $responseChecker,
62+
) {
63+
}
64+
```
65+
66+
### Having an API Client for a custom resource
67+
68+
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`.
69+
70+
```diff
71+
-<service id="app.behat.api_platform_client.admin.points" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
72+
+<service id="app.behat.api_platform_client.admin.points" class="Sylius1_11\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client.legacy">
73+
<argument>loyalty-points-accounts</argument>
74+
<argument>admin</argument>
75+
</service>
76+
```

0 commit comments

Comments
 (0)