Exemplo n.º 1
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $nameString = $input->getArgument('name');
     $name = new Name($nameString);
     $greeting = $this->helloService->getGreeting($name);
     $output->writeln($greeting);
 }
Exemplo n.º 2
0
 function it_can_output_a_message(HelloService $helloService, InputInterface $input, OutputInterface $output)
 {
     //ARRANGE
     // Some shit the Symfony Console component needs to be testable
     $input->bind(Argument::any())->shouldBeCalled();
     $input->isInteractive(Argument::any())->shouldBeCalled();
     $input->validate(Argument::any())->shouldBeCalled();
     // Prep the service
     $helloService->getGreeting(Argument::type('\\CodeKata\\RomanNumerals\\Domain\\Name'))->willReturn('Hello, Sam');
     // Give the command an input
     $input->getArgument('name')->willReturn('Sam');
     // ASSERT
     $output->writeln('Hello, Sam')->shouldBeCalled();
     // ACT
     $this->run($input, $output);
 }
Exemplo n.º 3
0
 /**
  * @When I ask to be said hello to
  */
 public function iAskToBeSaidHelloTo()
 {
     $helloService = new HelloService();
     $this->result = $helloService->getGreeting($this->name);
 }