public function __construct($plan = null, array $options = array()) { $this->options = array('base_dir' => null, 'output' => 'tap', 'force_colors' => false, 'verbose' => false, 'serialize' => false, 'coverage' => false); foreach (LimeShell::parseArguments($GLOBALS['argv']) as $argument => $value) { $this->options[str_replace('-', '_', $argument)] = $value; } $this->options = array_merge($this->options, $options); $this->options['base_dir'] = realpath($this->options['base_dir']); list($file, $line) = LimeTrace::findCaller('LimeTest'); if ($this->options['coverage']) { $this->output = new LimeOutputCoverage(); } elseif (is_string($this->options['output'])) { $factory = new LimeOutputFactory($this->options); $this->output = $factory->create($this->options['output']); } else { $this->output = $this->options['output']; } $this->output->focus($file); if (!is_null($plan)) { $this->output->plan($plan); } set_error_handler(array($this, 'handleError')); // make sure that exceptions that are not caught by the test runner are // caught and formatted in an appropriate way set_exception_handler(array($this, 'handleException')); }
public function __construct(array $options = array()) { $this->options = array_merge(array('base_dir' => null, 'executable' => null, 'output' => 'summary', 'force_colors' => false, 'verbose' => false, 'serialize' => false, 'processes' => 1), $options); foreach (LimeShell::parseArguments($GLOBALS['argv']) as $argument => $value) { $this->options[str_replace('-', '_', $argument)] = $value; } $this->options['base_dir'] = realpath($this->options['base_dir']); if (is_string($this->options['output'])) { $factory = new LimeOutputFactory($this->options); $type = $this->options['output']; $output = $factory->create($type); } else { $output = $this->options['output']; $type = get_class($output); } if ($this->options['processes'] > 1 && !$output->supportsThreading()) { throw new LogicException(sprintf('The output "%s" does not support multi-processing', $type)); } $this->output = new LimeOutputInspectable($output); }