Skip to content

Commit 7643b64

Browse files
authored
Merge pull request #8 from hrodic/1.x-dev
1.x dev
2 parents 0592dd4 + 89c9b2a commit 7643b64

File tree

1 file changed

+60
-4
lines changed

1 file changed

+60
-4
lines changed

README.md

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Currently you can run custom fixtures on the following PHPUnit hooks:
1717

1818
## Road map
1919

20-
* RabbitMQ integration
20+
* WIP: AMQP specific test fixtures with WithBeforeTestFixtureName and WithAfterTestFixtureName
2121

2222

2323
## Requirements
@@ -85,9 +85,65 @@ Example:
8585
},
8686
```
8787

88-
### RabbitMQ fixtures
88+
### AMQP fixtures
8989

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+
```
91147

92148
## Fixture creation
93149

@@ -158,4 +214,4 @@ You can have multiple SQL files and the extension will read and execute them in
158214
Integration testing requires some infrastructure to be in place.
159215

160216
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

Comments
 (0)