/** * @test */ public function anExceptionsReturnsErrorResponse() { $page = 3; $this->service->listShortUrls($page, null, [], null)->willThrow(\Exception::class)->shouldBeCalledTimes(1); $response = $this->action->__invoke(ServerRequestFactory::fromGlobals()->withQueryParams(['page' => $page]), new Response()); $this->assertEquals(500, $response->getStatusCode()); }
/** * @test */ public function ifTagsFlagIsProvidedTagsColumnIsIncluded() { $this->questionHelper->setInputStream($this->getInputStream('\\n')); $this->shortUrlService->listShortUrls(1, null, [], null)->willReturn(new Paginator(new ArrayAdapter()))->shouldBeCalledTimes(1); $this->commandTester->execute(['command' => 'shortcode:list', '--showTags' => true]); $output = $this->commandTester->getDisplay(); $this->assertTrue(strpos($output, 'Tags') > 0); }