public function storeMetaData(RestoreJob $job, JobStats $jobStats, array $storedStats, OutputInterface $output)
 {
     $memoryAtSection = memory_get_usage();
     $timeStartSection = microtime(true);
     $output->writeln('<info>*** Starting with meta data storing ***</info>' . PHP_EOL);
     $this->filesystem->storeRestoreServerInfo($job->getPath(), $job->getCreatedAt(), $job->getServerInfo());
     $output->writeln('<comment> - Stored server-info file</comment>' . PHP_EOL);
     $this->filesystem->storeRestoreStoredStats($job->getPath(), $job->getCreatedAt(), $storedStats);
     $output->writeln('<comment> - Stored stored-stats file</comment>' . PHP_EOL);
     $output->writeln('');
     $jobStats->setStoreMetaData(microtime(true) - $timeStartSection, memory_get_usage(), memory_get_usage() - $memoryAtSection, array('storedStats' => $storedStats));
 }
 public function testStoreRestoreStoredStatsNotExistingFolder()
 {
     $path = '/tmp/test-path';
     $datetimeString = '20151006100005_';
     /** @var \PHPUnit_Framework_MockObject_MockObject $dateTime */
     $dateTime = $this->getMockBuilder('DateTime')->disableOriginalConstructor()->getMock();
     $dateTime->expects($this->once())->method('format')->with('YmdHis_')->willReturn($datetimeString);
     $folderpath = $path . DIRECTORY_SEPARATOR . FilesystemRepositoryInterface::DIR_META . DIRECTORY_SEPARATOR . $datetimeString . FilesystemRepositoryInterface::DIR_SUB_RESTORE;
     $filepath = $folderpath . DIRECTORY_SEPARATOR . FilesystemRepositoryInterface::FILENAME_STORED_STATS . FilesystemRepositoryInterface::FILE_EXTENSION;
     $storedStats = [['properties' => []]];
     $this->filesystem->expects($this->once())->method('exists')->with($folderpath)->willReturn(false);
     $this->filesystem->expects($this->once())->method('mkdir')->with($folderpath);
     $this->filesystem->expects($this->once())->method('dumpFile')->with($filepath, json_encode($storedStats));
     $this->filesystemRepository->storeRestoreStoredStats($path, $dateTime, $storedStats);
 }