/**
  * Test building file.
  */
 public function testBuildFile()
 {
     $content = $this->builder->buildFile();
     $this->assertTrue(is_string($content));
     $this->assertContains('"app":', $content);
     $this->assertContains('"options":', $content);
     $this->assertContains('"update-file":', $content);
     $this->assertContains('"change-provider":', $content);
     $this->assertContains('"signing":', $content);
     $this->assertContains('"storage":', $content);
     $this->assertContains('"backup":', $content);
     $this->assertContains('"base-dir":', $content);
 }
예제 #2
0
 /**
  * Construct file structure.
  *
  * @param array $data
  *
  * @return array
  */
 public function constructFileStructure($data = [])
 {
     $file = parent::constructFileStructure($data);
     $file = array_replace_recursive($file, ['app' => ['name' => $data['app-name'], 'description' => $data['app-description'], 'app-key' => $data['app-key'], 'app-secret' => $data['app-secret']], 'options' => ['update' => ['backup-files' => $data['backup-files'], 'backup-database' => $data['backup-database']]], 'update-file' => ['class' => $data['update-class'], 'namespace' => $data['update-namespace']], 'change-provider' => ['driver' => $data['change-provider'], 'class' => $this->getChangeProviderClass($data['change-provider'])], 'signing' => ['private-key' => $data['private-key'], 'public-key' => $data['public-key']], 'storage' => ['tmp-dir' => 'slicer' . DIRECTORY_SEPARATOR . 'tmp', 'update-dir' => 'slicer' . DIRECTORY_SEPARATOR . 'updates', 'backup-dir' => $data['backup-dir']], 'backup' => ['exclude-dirs' => explode(',', $data['backup-ignore']), 'file-type' => $data['backup-type']], 'base-dir' => '']);
     $file['app']['name'] = strtr($file['app']['name'], "/", "/");
     $file['signing']['private-key'] = strtr($file['signing']['private-key'], '\\/', '/');
     $file['signing']['public-key'] = strtr($file['signing']['public-key'], '\\/', '/');
     $dirs = [];
     foreach ($file['backup']['exclude-dirs'] as $dir) {
         if ('' !== trim($dir)) {
             $dirs[] = strtr($dir, '\\/', '/');
         }
     }
     $file['backup']['exclude-dirs'] = $dirs;
     return $file;
 }