public function afterExample(ExampleEvent $exampleEvent) { $exception = $exampleEvent->getException(); if (!$exception instanceof NotEqualException) { return; } if ($exception->getActual() !== null) { return; } if (is_object($exception->getExpected()) || is_array($exception->getExpected()) || is_resource($exception->getExpected())) { return; } if (!$this->lastMethodCallEvent) { return; } $class = get_class($this->lastMethodCallEvent->getSubject()); $method = $this->lastMethodCallEvent->getMethod(); if (!$this->methodAnalyser->methodIsEmpty($class, $method)) { return; } $key = $class . '::' . $method; if (!array_key_exists($key, $this->nullMethods)) { $this->nullMethods[$key] = array('class' => $class, 'method' => $method, 'expected' => array()); } $this->nullMethods[$key]['expected'][] = $exception->getExpected(); }
function it_invokes_method_body_generation_when_prompt_is_answered_yes(MethodCallEvent $methodCallEvent, ExampleEvent $exampleEvent, IO $io, GeneratorManager $generatorManager, ResourceManager $resourceManager, ResourceInterface $resource, SuiteEvent $event) { $io->askConfirmation(Argument::any())->willReturn(true); $resourceManager->createResource(Argument::any())->willReturn($resource); $methodCallEvent->getSubject()->willReturn(new \StdClass()); $methodCallEvent->getMethod()->willReturn('myMethod'); $this->afterMethodCall($methodCallEvent); $this->afterExample($exampleEvent); $this->afterSuite($event); $generatorManager->generate($resource, 'returnConstant', array('method' => 'myMethod', 'expected' => 100))->shouldHaveBeenCalled(); }