visitsHelper = $this->createMock(VisitsStatsHelperInterface::class); $this->stringifier = $this->createMock(ShortUrlStringifierInterface::class); $this->commandTester = CliTestUtils::testerForCommand( new GetDomainVisitsCommand($this->visitsHelper, $this->stringifier), ); } #[Test] public function outputIsProperlyGenerated(): void { $shortUrl = ShortUrl::createFake(); $visit = Visit::forValidShortUrl($shortUrl, new Visitor('bar', 'foo', '', ''))->locate( VisitLocation::fromGeolocation(new Location('', 'Spain', '', 'Madrid', 0, 0, '')), ); $domain = 's.test'; $this->visitsHelper->expects($this->once())->method('visitsForDomain')->with( $domain, $this->anything(), )->willReturn(new Paginator(new ArrayAdapter([$visit]))); $this->stringifier->expects($this->once())->method('stringify')->with($shortUrl)->willReturn( 'the_short_url', ); $this->commandTester->execute(['domain' => $domain]); $output = $this->commandTester->getDisplay(); self::assertEquals( <<date->toAtomString()} | bar | Spain | Madrid | the_short_url | +---------+---------------------------+------------+---------+--------+---------------+ OUTPUT, $output, ); } }