public function testCreate()
 {
     $process = Phake::mock('React\\ChildProcess\\Process');
     $loop = Phake::mock('React\\EventLoop\\LoopInterface');
     $poolPromise = Fixed::create($process, $loop);
     $this->assertInstanceOf('React\\Promise\\PromiseInterface', $poolPromise);
     $promiseHasResolved = false;
     $poolPromise->then(function ($pool) use(&$promiseHasResolved) {
         $this->assertInstanceOf('WyriHaximus\\React\\ChildProcess\\Pool\\Pool\\Fixed', $pool);
         $this->assertInstanceOf('WyriHaximus\\React\\ChildProcess\\Pool\\PoolInterface', $pool);
         $promiseHasResolved = true;
     });
     $this->assertTrue($promiseHasResolved);
 }
 public function testManagerReady()
 {
     $function = null;
     $message = Factory::rpc('beer', ['foo' => 'bar']);
     $worker = Phake::mock('WyriHaximus\\React\\ChildProcess\\Pool\\WorkerInterface');
     $queue = Phake::mock('WyriHaximus\\React\\ChildProcess\\Pool\\QueueInterface');
     $manager = Phake::mock('WyriHaximus\\React\\ChildProcess\\Pool\\ManagerInterface');
     Phake::when($queue)->count()->thenReturn(4);
     Phake::when($queue)->dequeue()->thenReturn($message);
     Phake::when($manager)->on($this->isType('string'), $this->isType('callable'))->thenReturnCallback(function ($event, $passedFunction) use(&$function) {
         $function = $passedFunction;
     });
     $poolInstance = null;
     $process = Phake::mock('React\\ChildProcess\\Process');
     $loop = Phake::mock('React\\EventLoop\\LoopInterface');
     Fixed::create($process, $loop, [Options::MANAGER => $manager, Options::QUEUE => $queue])->then(function ($pool) use($message) {
         $pool->rpc($message);
     });
     $function($worker);
     Phake::verify($worker)->rpc($message);
 }