deleter = $this->createMock(VisitsDeleterInterface::class); $this->commandTester = CliTestUtils::testerForCommand(new DeleteOrphanVisitsCommand($this->deleter)); } #[Test] public function successMessageIsPrintedAfterDeletion(): void { $this->deleter->expects($this->once())->method('deleteOrphanVisits')->willReturn(new BulkDeleteResult(5)); $this->commandTester->setInputs(['yes']); $exitCode = $this->commandTester->execute([]); $output = $this->commandTester->getDisplay(); self::assertEquals(ExitCode::EXIT_SUCCESS, $exitCode); self::assertStringContainsString('You are about to delete all orphan visits.', $output); self::assertStringContainsString('Successfully deleted 5 visits', $output); } }