public function testLoopStartStop() { $timer = $this->getMock('React\\EventLoop\\Timer\\TimerInterface'); $this->loop->expects($this->exactly(2))->method('addPeriodicTimer')->with(0.1, $this->isType('callable'))->willReturn($timer); $timer->expects($this->once())->method('isActive')->willReturn(true); $timer->expects($this->once())->method('cancel'); $pcntl = new PCNTL($this->loop); $timer = $pcntl->start(); $this->assertInstanceOf('\\React\\EventLoop\\Timer\\TimerInterface', $timer); }
public function testConstruct_addsPeriodicTimer() { $this->loop->expects($this->once())->method('addPeriodicTimer')->with(0.1, $this->isType('callable')); new Handler($this->loop); }