function let(ContainerInterface $container, Runner $runner, Process $process, PHPUnitPlugin $plugin, Logger $logger)
 {
     if (is_null(static::$cwd)) {
         static::$cwd = getcwd();
     }
     //chdir(sys_get_temp_dir());
     $this->cacheFile = Inspector::getResultFileName();
     @unlink($this->cacheFile);
     $runner->setContainer($container);
     $runner->run(Argument::any())->willReturn($process);
     $runner->findExecutable('phpunit')->willReturn('phpunit');
     $container->get('runner')->willReturn($runner);
     $container->get('plugins.phpunit')->willReturn($plugin);
     $container->get('logger')->willReturn($logger);
     $container->setParameter('application.exit_code', Argument::any())->willReturn(true);
     $plugin->getOptions()->willReturn(array('cli' => '--some-options', 'all_after_pass' => false, 'run_all_cli' => '--some-run-all'));
     $plugin->getTitle()->willReturn('phpunit');
     $this->setContainer($container);
 }
Example #2
0
 /**
  * @codeCoverageIgnore
  */
 public function handleShutdown()
 {
     $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR);
     $lastError = error_get_last();
     if ($lastError && in_array($lastError['type'], $fatalErrors)) {
         $message = 'Fatal Error ' . $lastError['message'];
         $error = $lastError;
         $trace = file($this->errorFile);
         $traces = array();
         for ($i = 0, $count = count($trace); $i < $count; $i++) {
             $text = trim($trace[$i]);
             if (false !== ($pos = strpos($text, 'PHP '))) {
                 $text = substr($text, $pos + 4);
             }
             $traces[] = $text;
         }
         $event = ResultEvent::createError($message, $error, null, $traces);
         Filesystem::create()->serialize(Inspector::getResultFileName(), array($event));
         if ($this->coverageRunner) {
             $this->coverageRunner->saveState();
         }
     }
 }
 function it_should_delegate_run_all_to_inspector(Inspector $inspector)
 {
     $inspector->runAll()->shouldBeCalled()->willReturn('result');
     $this->runAll();
 }