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_does_not_prompt_when_method_is_not_empty(MethodCallEvent $methodCallEvent, ExampleEvent $exampleEvent, IO $io, MethodAnalyser $methodAnalyser, SuiteEvent $event) { $methodCallEvent->getMethod()->willReturn('myMethod'); $methodCallEvent->getSubject()->willReturn(new \DateTime()); $methodAnalyser->methodIsEmpty('DateTime', 'myMethod')->willReturn(false); $this->afterMethodCall($methodCallEvent); $this->afterExample($exampleEvent); $this->afterSuite($event); $io->askConfirmation(Argument::any())->shouldNotHaveBeenCalled(); }