Example #1
0
 public function testDestructor_stopsAllWatchers()
 {
     $watchers = [];
     $watchers[] = $this->getWatcherMock(['stop']);
     $watchers[] = $this->getWatcherMock(['stop']);
     $watchers[] = $this->getWatcherMock(['stop']);
     $eventLoop = new EventLoop();
     array_map(function ($watcher) use($eventLoop) {
         /** @var \PHPUnit_Framework_MockObject_MockObject|WatcherMock $watcher */
         $watcher->expects($this->atLeastOnce())->method('stop')->willReturn(true);
         $eventLoop->registerWatcher($watcher);
     }, $watchers);
     $eventLoop->__destruct();
 }