/**
  * @test
  */
 public function shouldRemoveSharedMemorySegmentDuringDestruction()
 {
     $this->fumocker->getMock('Vatson\\Callback\\Ipc', 'function_exists')->expects($this->once())->method('function_exists')->with('shm_attach')->will($this->returnValue(true));
     $this->fumocker->getMock('Vatson\\Callback\\Ipc', 'shm_attach')->expects($this->once())->method('shm_attach')->will($this->returnValue($this->shared_memory_segment_stub));
     $this->fumocker->getMock('Vatson\\Callback\\Ipc', 'shm_remove')->expects($this->once())->method('shm_remove')->with($this->shared_memory_segment_stub);
     $isolated_callback = new SharedMemory();
     unset($isolated_callback);
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     if (!function_exists('shm_attach') || !function_exists('pcntl_fork')) {
         $this->markTestSkipped('Required extensions are disabled');
     }
     // Dirty trick to override the native functions in the next unit tests
     if (version_compare(PHP_VERSION, '5.4', '>')) {
         $fumocker = new Fumocker();
         $fumocker->getMock('Vatson\\Callback', 'function_exists');
         $fumocker->getMock('Vatson\\Callback', 'shm_attach');
         $fumocker->getMock('Vatson\\Callback', 'shm_remove');
         $fumocker->cleanup();
     }
 }
 /**
  * Helps to automate the passing extensions checks
  *
  * @param callable $callback
  * @param IpcInterface $ipc
  * @return IsolatedCallback
  */
 protected function createIsolatedCallback($callback, IpcInterface $ipc = null)
 {
     $this->fumocker->getMock('Vatson\\Callback', 'function_exists')->expects($this->once())->method('function_exists')->with('pcntl_fork')->will($this->returnValue(true));
     return new IsolatedCallback($callback, $ipc);
 }