nuwber/rabbitevents

sync or dummy driver for testing environment

Closed this issue · 5 comments

colq2 commented

Hello,
great package, thank you for this!

Is it possible to add something like a built in sync or dummy driver for testing environments?

All laravel internal have some 'local' drivers like array for cache, memory for database or sync for queues. It makes testing scenarios very easy, because you don't need to deploy external services like rabbitmq.

Proposal:

Add a dummy driver which takes an event and it does just nothing with it. It's important, that the Listener::fake() should still work.

A config could looks like

    'connections' => [
        'rabbitmq' => [
             ...
        ],
        'testing' => [
            'driver' => 'dummy'
        ]
    ],

Hi @colq2

Thanks for your rate

This package was made to make possible a communication between different applications. That means that one app has implementation of publisher, another implements a Listener. I don't imagine how could it be implemented.

how about a command like:

php artisan rabbitevents:publish --event=item.updated --payload='{"item": {"id": 234, "name": "Item1"}'

No answer

Hi @colq2

Thanks for your rate

This package was made to make possible a communication between different applications. That means that one app has implementation of publisher, another implements a Listener. I don't imagine how could it be implemented.

It would indeed makes sense if you publish an event which would will also be consumed by the same application (publisher and listener)

Another use case is to check if an event was being dispatched. One can not use the Event::fake() method and Event::assertDispatched() because the nuwber/rabbitevents events work differently.