filesystem = $this->createMock(FilesystemOperator::class); $this->logger = new RecordingLogger(); $this->service = new DumpService( $this->createMock(DumpLister::class), $this->filesystem, $this->createMock(DumpBinaryLocator::class), $this->createMock(Connection::class), $this->createMock(SystemConfigService::class), new DumpFilenameParser(), $this->logger, ); } public function testDeleteLogsInfo(): void { $this->filesystem->method('fileExists')->willReturn(true); $this->filesystem->expects(self::once())->method('delete')->with(DumpLister::path(self::FILENAME)); $this->service->delete(self::FILENAME); self::assertSame( [['level' => 'info', 'message' => 'Dump deleted.', 'context' => ['filename' => self::FILENAME]]], $this->logger->records ); } public function testDeleteMissingDumpDoesNotLog(): void { $this->filesystem->method('fileExists')->willReturn(false); try { $this->service->delete(self::FILENAME); self::fail('Expected DumpNotFoundException.'); } catch (DumpNotFoundException) { self::assertSame([], $this->logger->records); } } }