visitsHelper = $this->createMock(VisitsStatsHelperInterface::class); $this->stringifier = $this->createMock(ShortUrlStringifierInterface::class); $this->commandTester = $this->testerForCommand( new GetNonOrphanVisitsCommand($this->visitsHelper, $this->stringifier), ); } /** @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, '')), ); $this->visitsHelper->expects($this->once())->method('nonOrphanVisits')->withAnyParameters()->willReturn( new Paginator(new ArrayAdapter([$visit])), ); $this->stringifier->expects($this->once())->method('stringify')->with($this->equalTo($shortUrl))->willReturn( 'the_short_url', ); $this->commandTester->execute([]); $output = $this->commandTester->getDisplay(); self::assertEquals( <<getDate()->toAtomString()} | bar | Spain | Madrid | the_short_url | +---------+---------------------------+------------+---------+--------+---------------+ OUTPUT, $output, ); } }