filesystemService = $this->createMock(FileSystemService::class); $this->filesystemHelper = $this->createMock(FileHelperService::class); $this->exporterHelper = $this->createMock(taoQtiTest_models_classes_export_TestExport22::class); $this->fileSystem = $this->createMock(FileSystem::class); $serviceLocator = $this->getServiceLocatorMock([ FileSystemService::SERVICE_ID => $this->filesystemService, FileHelperService::class => $this->filesystemHelper, ]); $this->subject = new PersistDataService( [PersistDataService::OPTION_EXPORTER_SERVICE => $this->exporterHelper] ); $this->subject->setServiceLocator($serviceLocator); } /** * @dataProvider provideDataForPersist * */ public function testPersist($params): void { $this->filesystemHelper->expects($this->once())->method('createTempDir') ->willReturn('bogusTestDirLocation'); $this->exporterHelper->expects($this->once())->method('export')->willReturn(true); $this->subject->persist($params); } public function provideDataForPersist(): array { return [ [ [ 'deliveryId' => 'bogus', 'testUri' => 'testBogus', 'deliveryMetaData' => [], 'testMetaData' => [], 'itemMetaData' => [], ], '' ] ]; } }