public function testLoadMappingsException()
 {
     $path = '/tmp/test-path';
     $schemaFolderPath = $path . DIRECTORY_SEPARATOR . FilesystemRepositoryInterface::DIR_SCHEMA;
     $this->filesystem->expects($this->once())->method('exists')->with($schemaFolderPath)->willReturn(false);
     try {
         $this->filesystemRepository->loadMappings($path);
     } catch (\Exception $exception) {
         $this->assertEquals('Schema folder does not exist in ' . $path, $exception->getMessage());
         return;
     }
     $this->fail();
 }
 /**
  * Stores config to yml config
  *
  * @param RestoreJob $job
  * @param OutputInterface $output
  * @author Daniel Wendlandt
  */
 private function storeConfig(RestoreJob $job, OutputInterface $output)
 {
     $mappingActions = array();
     foreach ($job->getStrategy()->getMappings() as $types) {
         /** @var RestoreStrategy\MappingAction $mappingAction */
         foreach ($types as $mappingAction) {
             $mappingActions[] = $mappingAction->toArray();
         }
     }
     $config = array('name' => $job->getName(), 'source' => $job->getSource(), 'host' => $job->getHost(), 'port' => $job->getPort(), 'create_config' => $job->isCreateConfig(), 'config_name' => $job->getConfigName(), 'strategy' => array('strategy' => $job->getStrategy()->getStrategy(), 'mappings' => $mappingActions), 'created_at' => $job->getCreatedAt()->format('Y-m-d H:i:s'));
     $this->filesystem->storeRestoreConfig($job, $config);
     $output->writeln('<info>*** Stored restore-config to file in yaml format ***</info>' . PHP_EOL);
 }
 /**
  * Stores config to yml config
  *
  * @param BackupJob $job
  * @param OutputInterface $output
  * @author Daniel Wendlandt
  */
 private function storeBackupConfig(BackupJob $job, OutputInterface $output)
 {
     $indices = array();
     /** @var Index $index */
     foreach ($job->getMappings()->getIndices() as $index) {
         /** @var Type $type */
         foreach ($index->getTypes() as $type) {
             $indices[] = array('index' => $index->getName(), 'type' => $type->getName());
         }
     }
     $config = array('name' => $job->getName(), 'target' => $job->getTarget(), 'host' => $job->getHost(), 'port' => $job->getPort(), 'indices' => $indices, 'created_at' => $job->getCreatedAt()->format('Y-m-d H:i:s'));
     $this->filesystem->storeBackupConfig($job->getPath(), $config);
     $output->writeln('<info>*** Stored backup-config to file im yaml format ***</info>' . PHP_EOL);
 }