/** * @test */ public function closeShouldStopListening() { $loop = $this->getMock('React\\EventLoop\\LoopInterface'); $loop->expects($this->once())->method('removeStream')->with(14); $socket = $this->getMockBuilder('ZMQSocket')->disableOriginalConstructor()->getMock(); $socket->expects($this->any())->method('getSockOpt')->with(ZMQ::SOCKOPT_FD)->will($this->returnValue(14)); $wrapped = new SocketWrapper($socket, $loop); $wrapped->close(); }