zipArchive = $this->createMock(ZipArchive::class); $this->subject = new ProcessDataService( [ProcessDataService::OPTION_ZIP_ARCHIVE_SERVICE => $this->zipArchive] ); } public function testProcess(): void { $zipFile = 'bogus/zipFile.zip'; $this->zipArchive->expects($this->once())->method('open')->with($zipFile); $this->zipArchive->expects($this->exactly(3))->method('addFromString'); $this->zipArchive->expects($this->once())->method('close'); $metaData = [ 'deliveryMetaData' => 'deliveryMetaData', 'testMetaData' => 'testMetaData', 'itemMetaData' => 'itemMetaData', ]; $this->subject->process($zipFile, $metaData); } }