visitsHelper = $this->prophesize(VisitsStatsHelperInterface::class); $this->stringifier = $this->prophesize(ShortUrlStringifierInterface::class); $this->commandTester = $this->testerForCommand( new GetDomainVisitsCommand($this->visitsHelper->reveal(), $this->stringifier->reveal()), ); } /** @test */ public function outputIsProperlyGenerated(): void { $shortUrl = ShortUrl::createEmpty(); $visit = Visit::forValidShortUrl($shortUrl, new Visitor('bar', 'foo', '', ''))->locate( VisitLocation::fromGeolocation(new Location('', 'Spain', '', 'Madrid', 0, 0, '')), ); $domain = 'doma.in'; $getVisits = $this->visitsHelper->visitsForDomain($domain, Argument::any())->willReturn( new Paginator(new ArrayAdapter([$visit])), ); $stringify = $this->stringifier->stringify($shortUrl)->willReturn('the_short_url'); $this->commandTester->execute(['domain' => $domain]); $output = $this->commandTester->getDisplay(); self::assertEquals( <<getDate()->toAtomString()} | bar | Spain | Madrid | the_short_url | +---------+---------------------------+------------+---------+--------+---------------+ OUTPUT, $output, ); $getVisits->shouldHaveBeenCalledOnce(); $stringify->shouldHaveBeenCalledOnce(); } }