visitsHelper = $this->createMock(VisitsStatsHelperInterface::class); $this->commandTester = CliTestUtils::testerForCommand(new GetOrphanVisitsCommand($this->visitsHelper)); } #[Test] #[TestWith([[], false])] #[TestWith([['--type' => OrphanVisitType::BASE_URL->value], true])] public function outputIsProperlyGenerated(array $args, bool $includesType): void { $visit = Visit::forBasePath(new Visitor('bar', 'foo', '', ''))->locate( VisitLocation::fromGeolocation(new Location('', 'Spain', '', 'Madrid', 0, 0, '')), ); $this->visitsHelper->expects($this->once())->method('orphanVisits')->with($this->callback( fn (OrphanVisitsParams $param) => ( ($includesType && $param->type !== null) || (!$includesType && $param->type === null) ), ))->willReturn(new Paginator(new ArrayAdapter([$visit]))); $this->commandTester->execute($args); $output = $this->commandTester->getDisplay(); self::assertEquals( <<getDate()->toAtomString()} | bar | Spain | Madrid | base_url | +---------+---------------------------+------------+---------+--------+----------+ OUTPUT, $output, ); } }