Esempio n. 1
0
 public function testDispatchWrongHandler()
 {
     $this->setExpectedException('Sulu\\Component\\Websocket\\Exception\\HandlerNotFoundException', 'Handler "test-2" not found');
     $context = $this->prophesize('Sulu\\Component\\Websocket\\MessageDispatcher\\MessageHandlerContext');
     $conn = $this->prophesize('Ratchet\\ConnectionInterface');
     $message = ['test' => '1'];
     $handler = $this->prophesize('Sulu\\Component\\Websocket\\MessageDispatcher\\MessageHandlerInterface');
     $handler->handle($conn->reveal(), $message, $context->reveal());
     $dispatcher = new MessageDispatcher();
     $dispatcher->add('test', $handler->reveal());
     $result = $dispatcher->dispatch($conn->reveal(), 'test-2', $message, ['id' => 'test'], $context->reveal());
     $this->assertEquals(null, $result);
 }