public function afterSuite() { Filesystem::create()->serialize(Inspector::getCacheFileName(), $this->results); if ($this->coverage) { $this->coverage->saveState(); } }
public function __construct() { // always clear serialized result when Inspector object created $file = Inspector::getCacheFileName(); if (file_exists($file)) { unlink($file); } }
public function configure() { $container = $this->container; // only load command when phpspec package exists /* @var \PhpGuard\Application\Console\Application $application */ $application = $container->get('ui.application'); $command = new DescribeCommand(); $command->setContainer($this->container); $application->add($command); $logger = $this->logger; $options = $this->options; $container->setShared('phpspec.inspector', function ($c) use($logger, $options) { $inspector = new Inspector(); $inspector->setLogger($logger); $inspector->setContainer($c); return $inspector; }); }
function let(ContainerInterface $container, Runner $runner, Process $process, Logger $logger, PluginInterface $plugin) { $this->cacheFile = Inspector::getCacheFileName(); $container->get('runner')->willReturn($runner); $container->get('logger')->willReturn($logger); $container->get('plugins.phpspec')->willReturn($plugin); $runner->run(Argument::any())->willReturn($process); $runner->setContainer($container); $plugin->getOptions()->willReturn(array('cli' => '--some-options', 'all_after_pass' => false, 'keep_failed' => true, 'run_all' => array('cli' => 'run-all'))); $this->setContainer($container); $this->setLogger($logger); }
public function testShouldLoadProperly() { touch(Inspector::getCacheFileName()); $this->getExtension(); $this->assertFalse(file_exists(Inspector::getCacheFileName())); }
/** * @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::getCacheFileName(), array($event)); } return false; }
protected function clearCache() { @unlink(Inspector::getCacheFileName()); }