public function createChannel($methods = null)
{
$model = $this->getMock(ChannelModelInterface::class, [], [], '', false);
$model->expects($this->any())->method('copyEvents')->will($this->returnCallback(function ($obj, $events) {
$handlers = [];
foreach ($events as $event) {
$handlers[] = $this->getMock(EventListener::class, [], [], '', false);
}
return $handlers;
}));
$model->expects($this->any())->method('on')->will($this->returnCallback(function ($event, $callback) {
return $this->getMock(EventListener::class, [], [], '', false);
}));
$router = $this->getMock(RouterCompositeInterface::class, [], [], '', false);
$router->expects($this->any())->method('getBus')->will($this->returnValue(null));
$encoder = $this->getMock(EncoderInterface::class, [], [], '', false);
$loop = $this->getMock(LoopInterface::class, [], [], '', false);
$mock = $this->getMock(Channel::class, $methods, ['name', $model, $router, $encoder, $loop]);
$this->channel = $mock;
return $mock;
}