/**
  * @test
  */
 public function exceptionWhileParsingLongUrlOutputsError()
 {
     $this->urlShortener->urlToShortCode(Argument::cetera())->willThrow(new InvalidUrlException())->shouldBeCalledTimes(1);
     $this->commandTester->execute(['command' => 'shortcode:generate', 'longUrl' => 'http://domain.com/invalid']);
     $output = $this->commandTester->getDisplay();
     $this->assertTrue(strpos($output, 'Provided URL "http://domain.com/invalid" is invalid. Try with a different one.') === 0);
 }
 /**
  * @test
  */
 public function aGenericExceptionWillReturnError()
 {
     $this->urlShortener->urlToShortCode(Argument::type(Uri::class), Argument::type('array'))->willThrow(\Exception::class)->shouldBeCalledTimes(1);
     $request = ServerRequestFactory::fromGlobals()->withParsedBody(['longUrl' => 'http://www.domain.com/foo/bar']);
     $response = $this->action->__invoke($request, new Response());
     $this->assertEquals(500, $response->getStatusCode());
     $this->assertTrue(strpos($response->getBody()->getContents(), RestUtils::UNKNOWN_ERROR) > 0);
 }