function it_dispatches_beforeSpec_events(Environment $env, Spec $spec, $dispatcher, InvokableMethod $method) { $dispatcher->dispatch('beforeSpec', Argument::type('Symfony\\Component\\EventDispatcher\\GenericEvent'))->shouldBeCalled(); $dispatcher->dispatch('afterSpec', Argument::type('Symfony\\Component\\EventDispatcher\\GenericEvent'))->shouldBeCalled(); $spec->getExamples()->willReturn($method); $this->test($env, $spec); }
private function getMethods(Spec $spec) { $reflection = $spec->getReflection(); $result = []; $methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC ^ \ReflectionMethod::IS_ABSTRACT); foreach ($methods as $method) { if (0 !== strpos($method->getName(), 'it_')) { continue; } $result[] = new InvokableMethod($method); } return $result; }
function let(Suite $suite, Spec $spec, \ReflectionClass $refl) { $spec->getReflection()->willReturn($refl); $this->beConstructedWith($suite, $spec); }