public function testStoreStoredStats() { $path = '/tmp/test-path'; $filepath = $path . DIRECTORY_SEPARATOR . FilesystemRepositoryInterface::DIR_META . DIRECTORY_SEPARATOR . FilesystemRepositoryInterface::FILENAME_STORED_STATS . FilesystemRepositoryInterface::FILE_EXTENSION; $storedStats = [['properties' => []]]; $this->filesystem->expects($this->never())->method('exists'); $this->filesystem->expects($this->never())->method('mkdir'); $this->filesystem->expects($this->once())->method('dumpFile')->with($filepath, json_encode($storedStats)); $this->filesystemRepository->storeStoredStats($path, $storedStats); }
/** * Stores meta data to backup folder * * @param BackupJob $job * @param JobStats $jobStats * @param array $storedStats * @param OutputInterface $output * @author Daniel Wendlandt */ private function storeMetaData(BackupJob $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->storeServerInfo($job->getPath(), $job->getServerInfo()); $output->writeln('<comment> - Stored server-info file</comment>' . PHP_EOL); $this->filesystem->storeStoredStats($job->getPath(), $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); }