@@ -17,7 +17,7 @@ Currently you can run custom fixtures on the following PHPUnit hooks:
17
17
18
18
## Road map
19
19
20
- * RabbitMQ integration
20
+ * WIP: AMQP specific test fixtures with WithBeforeTestFixtureName and WithAfterTestFixtureName
21
21
22
22
23
23
## Requirements
@@ -85,9 +85,65 @@ Example:
85
85
},
86
86
```
87
87
88
- ### RabbitMQ fixtures
88
+ ### AMQP fixtures
89
89
90
- @todo
90
+ You can also try out AMQP (tested on RabbitMQ) fixtures and operations.
91
+
92
+ Configure your connectivity and the hook operations using the configuration file.
93
+
94
+ Notes:
95
+ * Hook definitions are optional, so just configure the ones you need.
96
+ * You can only publish messages on ` beforeFirstTest ` and on ` beforeTest ` .
97
+ * You can purge queues in all four hooks.
98
+ * file extension of message bodies to publish defaults to ` json `
99
+ * use ` routing_key ` if you have your exchange configured as ` direct ` . You can define it as empty string if ` fanout `
100
+
101
+ ```
102
+ "amqp": {
103
+ "host": "localhost",
104
+ "port": 5672,
105
+ "user": "test",
106
+ "password": "test",
107
+ "vhost": "/",
108
+ "fixtures": {
109
+ "beforeFirstTest": {
110
+ "purgeQueues": [
111
+ "before-first-test-queue"
112
+ ],
113
+ "publishMessages": [
114
+ {
115
+ "exchange": "test-exchange",
116
+ "queue": "before-first-test-queue",
117
+ "routing_key": "before-first-test",
118
+ "path": "tests/fixtures/before-first-test",
119
+ "extension": "json"
120
+ }
121
+ ]
122
+ },
123
+ "beforeTest": {
124
+ "purgeQueues": [
125
+ "before-test-queue"
126
+ ],
127
+ "publishMessages": [
128
+ {
129
+ "exchange": "test-exchange",
130
+ "queue": "before-test-queue",
131
+ "routing_key": "before-test",
132
+ "path": "tests/fixtures/before-test"
133
+ }
134
+ ]
135
+ },
136
+ "afterTest": {
137
+ "purgeQueues": [
138
+ "before-test-queue"
139
+ ]
140
+ },
141
+ "afterLastTest": {
142
+ "purgeQueues": []
143
+ }
144
+ }
145
+ }
146
+ ```
91
147
92
148
## Fixture creation
93
149
@@ -158,4 +214,4 @@ You can have multiple SQL files and the extension will read and execute them in
158
214
Integration testing requires some infrastructure to be in place.
159
215
160
216
This library assumes (you can check docker-compose.yml file for inspiration) that you have an accessible database
161
- or other infrastructure already in place and the database is created.
217
+ or other infrastructure already in place and the database is created.
0 commit comments