spec\PhpSpec\Runner\ExampleRunnerSpec::it_dispatches_ExampleEvent_with_failed_status_if_example_throws_an_error PHP Метод

it_dispatches_ExampleEvent_with_failed_status_if_example_throws_an_error() публичный Метод

public it_dispatches_ExampleEvent_with_failed_status_if_example_throws_an_error ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, ExampleNode $example, ReflectionMethod $exampReflection, PhpSpec\Specification $context )
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$example PhpSpec\Loader\Node\ExampleNode
$exampReflection ReflectionMethod
$context PhpSpec\Specification
    function it_dispatches_ExampleEvent_with_failed_status_if_example_throws_an_error(EventDispatcherInterface $dispatcher, ExampleNode $example, ReflectionMethod $exampReflection, Specification $context)
    {
        if (!class_exists('\\Error')) {
            throw new SkippingException('The class Error, introduced in PHP 7, does not exist');
        }
        $example->isPending()->willReturn(false);
        $exampReflection->getParameters()->willReturn(array());
        $exampReflection->invokeArgs($context, array())->willThrow('Error');
        $dispatcher->dispatch('beforeExample', Argument::any())->shouldBeCalled();
        $dispatcher->dispatch('afterExample', Argument::which('getResult', ExampleEvent::BROKEN))->shouldBeCalled();
        $this->run($example);
    }