Exemplo n.º 1
0
 public function testPipeProperEventHandler()
 {
     $configuration = array('Malocher\\CqrsTest\\Coverage\\Mock\\Event\\MockEventHandler');
     $this->adapter->pipe($this->bus, $configuration);
     $map = $this->bus->getEventListenerMap()['Malocher\\CqrsTest\\Coverage\\Mock\\Event\\MockEvent'];
     $this->assertNotNull($map);
     $this->assertEquals('Malocher\\CqrsTest\\Coverage\\Mock\\Event\\MockEventHandler', $map[0]['alias']);
 }
Exemplo n.º 2
0
 public function testReset()
 {
     $mockBus = new MockBus();
     $mockBus->setCommandHandlerLoader(new ClassMapCommandHandlerLoader());
     $mockBus->setEventListenerLoader(new ClassMapEventListenerLoader());
     $mockBus->setQueryHandlerLoader(new ClassMapQueryHandlerLoader());
     $this->gate->attach($mockBus);
     $this->gate->reset();
     $attachedBuses = $this->gate->attachedBuses();
     $this->assertEquals(0, count($attachedBuses));
 }
Exemplo n.º 3
0
 public function testPublishEventHandlerNoEventHandlerLoader()
 {
     $this->setExpectedException('Malocher\\Cqrs\\Bus\\BusException');
     $bus = new MockBus();
     $bus->setGate(new Gate());
     $bus->registerEventListener('Malocher\\CqrsTest\\Coverage\\Mock\\Event\\MockEvent', array('alias' => 'Malocher\\CqrsTest\\Coverage\\Mock\\Event\\MockEventHandler', 'method' => 'handleEvent'));
     $mockEvent = new MockEvent();
     $bus->publishEvent($mockEvent);
 }