Kraken\_Unit\Channel\ChannelTest::createChannel PHP Method

createChannel() public method

public createChannel ( string[] | null $methods = null ) : Channel | PHPUnit_Framework_MockObject_MockObject
$methods string[] | null
return Kraken\Channel\Channel | PHPUnit_Framework_MockObject_MockObject
    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;
    }
ChannelTest