Kraken\_Unit\Channel\Extra\RequestTest::createChannelMock PHP Method

createChannelMock() private method

private createChannelMock ( string $name ) : Channel | PHPUnit_Framework_MockObject_MockObject
$name string
return Kraken\Channel\Channel | PHPUnit_Framework_MockObject_MockObject
    private function createChannelMock($name)
    {
        $loop = $this->getMock(Loop::class, [], [], '', false);
        $loop->expects($this->any())->method('addTimer')->with($this->isType('numeric'), $this->isType('callable'))->will($this->returnCallback(function ($interval, $callable) {
            $callable();
        }));
        $loop->expects($this->any())->method('onTick')->with($this->isType('callable'))->will($this->returnCallback(function ($callable) {
            $callable();
        }));
        $channel = $this->getMock(Channel::class, [], [], '', false);
        $channel->expects($this->atMost(1))->method('createProtocol')->will($this->returnCallback(function ($message = null) use($name) {
            return new Protocol('', 'uniqueID', '', $name, $message, '', 0);
        }));
        $channel->expects($this->any())->method('getLoop')->will($this->returnValue($loop));
        return $channel;
    }