|
1 |
| -Behat Messenger Context Bundle |
2 |
| -================================= |
| 1 | +# Behat Messenger Context Bundle |
3 | 2 |
|
4 | 3 | | Version | Build Status | Code Coverage |
|
5 | 4 | |:---------:|:-------------:|:-----:|
|
6 | 5 | | `master`| [![CI][master Build Status Image]][master Build Status] | [![Coverage Status][master Code Coverage Image]][master Code Coverage] |
|
7 | 6 | | `develop`| [![CI][develop Build Status Image]][develop Build Status] | [![Coverage Status][develop Code Coverage Image]][develop Code Coverage] |
|
8 | 7 |
|
9 |
| -Installation |
10 |
| -============ |
| 8 | +This repository provides custom Behat step definitions for working with Symfony Messenger transports. It includes functionality for checking messages in transports, validating them against expected JSON structures, and working with variable fields. |
11 | 9 |
|
12 |
| -Step 1: Download the Bundle |
13 |
| ----------------------------------- |
14 |
| -Open a command console, enter your project directory and execute: |
| 10 | +## Installation |
15 | 11 |
|
16 |
| -### Applications that use Symfony Flex [in progress](https://github.com/MacPaw/BehatRedisContext/issues/2) |
| 12 | +To install the MessengerContext and integrate it with your Behat setup, follow the instructions provided in the [Installation Guide](docs/install.md). |
17 | 13 |
|
18 |
| -```console |
19 |
| -$ composer require --dev macpaw/behat-messenger-context |
20 |
| -``` |
| 14 | +## Available Features |
21 | 15 |
|
22 |
| -### Applications that don't use Symfony Flex |
| 16 | +### Check a Specific Message in a Transport |
| 17 | +You can verify if a specific message exists in a given transport. |
| 18 | +* Documentation: [Check Transport Message](docs/MessengerContext/check_transport_message.md) |
23 | 19 |
|
24 |
| -Open a command console, enter your project directory and execute the |
25 |
| -following command to download the latest stable version of this bundle: |
| 20 | +### Check All Messages in a Transport |
| 21 | +Verify if all messages in a given transport match the expected JSON structure. |
| 22 | +* Documentation: [Check All Transport Messages](docs/MessengerContext/check_all_transport_message.md) |
26 | 23 |
|
27 |
| -```console |
28 |
| -$ composer require --dev macpaw/behat-messenger-context |
29 |
| -``` |
| 24 | +### Check Messages with Regular Expressions |
| 25 | +You can use regular expressions to validate messages that contain dynamic or variable data. |
| 26 | +* Documentation for specific message: [Check Transport Message with Regexp](docs/MessengerContext/check_transport_message_regexp.md) |
| 27 | +* Documentation for all messages: [Check All Transport Messages with Regexp](docs/MessengerContext/check_all_transport_message_regexp.md) |
30 | 28 |
|
31 |
| -This command requires you to have Composer installed globally, as explained |
32 |
| -in the [installation chapter](https://getcomposer.org/doc/00-intro.md) |
33 |
| -of the Composer documentation. |
| 29 | +### Verify Message Count in a Transport |
| 30 | +Ensure that a specific number of messages exist in a given transport. |
34 | 31 |
|
35 |
| - |
36 |
| -Then, enable the bundle by adding it to the list of registered bundles |
37 |
| -in the `app/AppKernel.php` file of your project: |
38 |
| - |
39 |
| -```php |
40 |
| -<?php |
41 |
| -// app/AppKernel.php |
42 |
| - |
43 |
| -// ... |
44 |
| -class AppKernel extends Kernel |
45 |
| -{ |
46 |
| - public function registerBundles() |
47 |
| - { |
48 |
| - $bundles = array( |
49 |
| - // ... |
50 |
| - BehatMessengerContext\BehatMessengerContextBundle::class => ['test' => true], |
51 |
| - ); |
52 |
| - |
53 |
| - // ... |
54 |
| - } |
55 |
| - |
56 |
| - // ... |
57 |
| -} |
58 |
| -``` |
59 |
| - |
60 |
| -Step 2: Configure Messenger |
61 |
| -============= |
62 |
| -Copying `config/packages/dev/messenger.yaml` and pasting that into `config/packages/test/`. This gives us messenger configuration that will only be used in the test environment. Uncomment the code, and replace sync with in-memory. Do that for both of the transports. |
63 |
| - |
64 |
| -```yaml |
65 |
| -framework: |
66 |
| - messenger: |
67 |
| - transports: |
68 |
| - async: 'in-memory://' |
69 |
| - async_priority_high: 'in-memory://' |
70 |
| - ... |
71 |
| -... |
72 |
| -``` |
73 |
| - |
74 |
| - |
75 |
| -Step 3: Configure Behat |
76 |
| -============= |
77 |
| -Go to `behat.yml` |
78 |
| - |
79 |
| -```yaml |
80 |
| -... |
81 |
| - contexts: |
82 |
| - - BehatMessengerContext\Context\MessengerContext |
83 |
| -... |
84 |
| -``` |
| 32 | +* Documentation: [Count Messages in Transport](docs/MessengerContext/count_message_transport.md) |
85 | 33 |
|
86 | 34 | [master Build Status]: https://github.com/macpaw/behat-messenger-context/actions?query=workflow%3ACI+branch%3Amaster
|
87 | 35 | [master Build Status Image]: https://github.com/macpaw/behat-messenger-context/workflows/CI/badge.svg?branch=master
|
|
0 commit comments