zenstruck / messenger-test

Assertions and helpers for testing your symfony/messenger queues.
MIT License
218 stars 15 forks source link

Allow `TestTransport::send()` to accept `object|array` #50

Closed kbond closed 1 year ago

kbond commented 1 year ago

This makes it easier to send a message with no stamps (removes the requirement for wrapping in an envelope). Additionally, allows sending a "pre-encoded" message array.

Closes #49.

kbond commented 1 year ago

@amanformuli mind reviewing this? I ended up having send() able to take the array instead of a separate method. Does it in fact solve #49?

amanformuli commented 1 year ago

I guess send() with array parameter will be fine as well. I need to test from my end as well though ;-)

Thanks Kevin

kbond commented 1 year ago

Do you mind testing this PR in your project before I merge then? I'd like to ensure it solves your use-case.

amanformuli commented 1 year ago

Do you mind testing this PR in your project before I merge then? I'd like to ensure it solves your use-case.

Hi Kevin,

I tested the PR and it worked as I expected :-). You can merge the PR now.

Thanks a lot, Aman

kbond commented 1 year ago

Thanks for testing @amanformuli, merged and released. I didn't add the ability to pass a json string to ->send() as discussed here but let me know if you have this need (ie you are doing ->send(json_decode($string)) in your code).

amanformuli commented 1 year ago

Thanks @kbond for the release. I updated the tool to version 1.5 and it works great 👍 Well passing array type parameter is fine.