/** * @test * @dataProvider dispatcherDataProvider * * @param array $configuration */ public function itShouldDipatch($configuration) { $dispatcher = new DispatcherCollector(); $requestObject = new RequestObject(); $dispatcher->setLoggerCollector($this->logger->reveal()); $dispatcher->setPersisterCollector($this->persister->reveal()); $dispatcher->setMailerCollector($this->mailer->reveal()); if ($configuration['logger']['enabled']) { $this->logger->collect(Argument::type(RequestObject::class), Argument::type('array'))->shouldBeCalled(); } else { $this->logger->collect(Argument::type(RequestObject::class), Argument::type('array'))->shouldNotBeCalled(); } if ($configuration['persister']['enabled']) { $this->persister->collect(Argument::type(RequestObject::class))->shouldBeCalled(); } else { $this->persister->collect(Argument::type(RequestObject::class))->shouldNotBeCalled(); } if ($configuration['mailer']['enabled']) { $this->mailer->collect(Argument::type(RequestObject::class), Argument::type('array'))->shouldBeCalled(); } else { $this->mailer->collect(Argument::type(RequestObject::class), Argument::type('array'))->shouldNotBeCalled(); } $dispatcher->dispatch($requestObject, $configuration); }