visitsHelper = $this->createMock(VisitsStatsHelperInterface::class); $this->commandTester = CliTestUtils::testerForCommand(new GetDomainVisitsCommand($this->visitsHelper)); } #[Test] public function outputIsProperlyGenerated(): void { $shortUrl = ShortUrl::createFake(); $visit = Visit::forValidShortUrl($shortUrl, Visitor::fromParams('bar', 'foo', ''))->locate( VisitLocation::fromLocation(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->commandTester->execute(['domain' => $domain]); $output = $this->commandTester->getDisplay(); $type = VisitType::VALID_SHORT_URL->value; self::assertEquals( // phpcs:disable Generic.Files.LineLength <<date->toAtomString()} | | bar | foo | Spain | | Madrid | | Unknown | {$type} | +---------------------------+---------------+------------+------- Page 1 of 1 --------+--------+-------------+--------------+-----------------+ OUTPUT, // phpcs:enable $output, ); } }