function it_prompts_for_method_generation_if_methodnotfoundexception_was_thrown_and_input_is_interactive($exampleEvent, $suiteEvent, $io, NameCheckerInterface $nameChecker) { $exception = new MethodNotFoundException('Error', new \stdClass(), 'bar'); $exampleEvent->getException()->willReturn($exception); $nameChecker->isNameValid('bar')->willReturn(true); $this->afterExample($exampleEvent); $this->afterSuite($suiteEvent); $io->askConfirmation(Argument::any())->shouldHaveBeenCalled(); }
private function checkIfMethodNameAllowed($methodName) { if (!$this->nameChecker->isNameValid($methodName)) { $this->wrongMethodNames[] = $methodName; } }
function it_warns_if_a_method_name_is_wrong(ExampleEvent $event, SuiteEvent $suiteEvent, IO $io, NameCheckerInterface $nameChecker) { $exception = new MethodNotFoundException('Error', new DoubleOfInterface(), 'throw'); $event->getException()->willReturn($exception); $nameChecker->isNameValid('throw')->willReturn(false); $io->writeBrokenCodeBlock("I cannot generate the method 'throw' for you because it is a reserved keyword", 2)->shouldBeCalled(); $io->askConfirmation(Argument::any())->shouldNotBeCalled(); $this->afterExample($event); $this->afterSuite($suiteEvent); }