function it_should_run_stage(Job $phpspecJob, Job $phpunitJob, Process $phpspecProcess, Process $phpunitProcess)
 {
     $stageName = 'dev-publish-stage';
     $projectDir = vfsStream::url('root/project');
     $gitlabYamlPath = $projectDir . '/.gitlab-ci.yml';
     $refName = 'develop';
     $sleep = 20;
     $volumes = ['/artifact_repository:/artifact_repository'];
     $this->gitlabCIConfigurationFactory->createFromYaml($gitlabYamlPath)->willReturn($this->gitlabCIConfiguration);
     $this->gitlabCIConfiguration->getJobsForStage('dev-publish-stage')->willReturn(['phpspec_php_5_6', 'phpunit_php_5_6']);
     $phpspecCommand = 'phpspec some docker run command';
     $phpunitCommand = 'phpunit some docker run command';
     $variables = [new Variable('some', 'value')];
     $this->gitlabCIConfiguration->variables()->willReturn($variables);
     $this->gitlabCIConfiguration->getJob('phpspec_php_5_6')->willReturn($phpspecJob);
     $this->gitlabCIConfiguration->getJob('phpunit_php_5_6')->willReturn($phpunitJob);
     $this->consoleCommandFactory->createDockerRunCommand($phpspecJob, $variables, $projectDir, $refName, $sleep, $volumes)->willReturn($phpspecCommand);
     $this->consoleCommandFactory->createDockerRunCommand($phpunitJob, $variables, $projectDir, $refName, $sleep, $volumes)->willReturn($phpunitCommand);
     $this->processRunner->runProcess($phpspecJob, $phpspecCommand)->willReturn($phpspecProcess);
     $this->processRunner->runProcess($phpunitJob, $phpunitCommand)->willReturn($phpunitProcess);
     $phpspecProcess->isRunning()->willReturn(false);
     $phpunitProcess->isRunning()->willReturn(false);
     $phpspecProcess->isSuccessful()->shouldBeCalledTimes(1)->willReturn(true);
     $phpunitProcess->isSuccessful()->shouldBeCalledTimes(1)->willReturn(true);
     $this->runStage($stageName, $gitlabYamlPath, $refName, $sleep, $volumes);
 }
 /**
  * Run all jobs in stage
  *
  * @param string    $stageName
  * @param string    $gitlabCiPath
  * @param string    $refName
  * @param null|int  $sleep
  * @param array     $volumes
  *
  * @throws PrivateRunnerException
  */
 public function runStage($stageName, $gitlabCiPath, $refName, $sleep = null, array $volumes = [])
 {
     $gitlabCIConfiguration = $this->gitlabCIConfigurationFactory->createFromYaml($gitlabCiPath);
     $jobNames = $gitlabCIConfiguration->getJobsForStage($stageName);
     $this->runJobs($jobNames, $gitlabCiPath, $refName, $sleep, $volumes);
 }