|
@@ 29-40 (lines=12) @@
|
| 26 |
|
$this->eventChannel = new EventChannel($this->eventDispatcher); |
| 27 |
|
} |
| 28 |
|
|
| 29 |
|
public function testDispatch() |
| 30 |
|
{ |
| 31 |
|
$this->eventDispatcher->expects($this->once())->method('dispatch'); |
| 32 |
|
|
| 33 |
|
$dispatcher = $this->getMockDispatcher(); |
| 34 |
|
$this->eventChannel->setDispatchers('default', $dispatcher); |
| 35 |
|
|
| 36 |
|
$message = $this->getTestMessage(); |
| 37 |
|
$message->setChannel('default'); |
| 38 |
|
|
| 39 |
|
$this->eventChannel->dispatch($message); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
public function testDispatchWithWrongChannelKey() |
| 43 |
|
{ |
|
@@ 42-53 (lines=12) @@
|
| 39 |
|
$this->eventChannel->dispatch($message); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
public function testDispatchWithWrongChannelKey() |
| 43 |
|
{ |
| 44 |
|
$dispatcher = $this->getMockDispatcher(); |
| 45 |
|
$this->eventChannel->setDispatchers('default', $dispatcher); |
| 46 |
|
|
| 47 |
|
$message = $this->getTestMessage(); |
| 48 |
|
$message->setChannel('not-default'); |
| 49 |
|
|
| 50 |
|
$this->setExpectedException(MessageDispatchException::class); |
| 51 |
|
|
| 52 |
|
$this->eventChannel->dispatch($message); |
| 53 |
|
} |
| 54 |
|
} |
| 55 |
|
|