Tests a more realistic scenario where:
- a payload is received
- events are fully dispatched
We mock the broker to allow to run the test without one.
This bumps the dependency to Keruald Broker from 0.1 to 0.2.
Differential D197
Payload full test, with a blackhole broker dereckson on Jan 9 2016, 05:33. Authored by Tags Referenced Files
Subscribers None
Details
Tests a more realistic scenario where:
We mock the broker to allow to run the test without one. This bumps the dependency to Keruald Broker from 0.1 to 0.2. phpunit
Diff Detail
Event TimelineComment Actions We need to mock the broker. Code to mock Broker::setExchangeTarget($this->target) ->routeTo($this->routingKey) ->sendMessage($this->message); Mock proposal $mock = Mockery('Keruald\Broker\AMQPBroker'); $mock->shouldReceive('setExchangeTarget'); // TODO: return $this, not null $mock->shouldReceive('routeTo'); $mock->shouldReceive('sendMessage'); $this->app->instance('broker', $mock); Reference: http://docs.mockery.io/en/latest/reference/demeter_chains.html Comment Actions For reference, the following method mocks correctly the broker: Working mock code $mock = Mockery::mock('Keruald\Broker\Broker'); $mock->shouldReceive('connect'); $mock->shouldReceive('setExchangeTarget->routeTo->sendMessage'); $this->app->instance('broker', $mock); |