PHPSpec2\Runner\Runner::runSpecification PHP Method

runSpecification() public method

public runSpecification ( Specification $specification )
$specification PHPSpec2\Loader\Node\Specification
    public function runSpecification(Node\Specification $specification)
    {
        if (defined('PHPSPEC_ERROR_REPORTING')) {
            $errorLevel = PHPSPEC_ERROR_REPORTING;
        } else {
            $errorLevel = E_ALL ^ E_STRICT;
        }
        $oldHandler = set_error_handler(array($this, 'errorHandler'), $errorLevel);
        $this->eventDispatcher->dispatch('beforeSpecification', new Event\SpecificationEvent($specification));
        $startTime = microtime(true);
        $result = Event\ExampleEvent::PASSED;
        foreach ($specification->getChildren() as $child) {
            $result = max($result, $this->runExample($child));
        }
        $this->eventDispatcher->dispatch('afterSpecification', new Event\SpecificationEvent($specification, microtime(true) - $startTime, $result));
        if (null !== $oldHandler) {
            set_error_handler($oldHandler);
        }
        return $result;
    }