Ejemplo n.º 1
0
 function it_should_execute_the_compression_command(Compressor $compressor, ShellProcessor $shellProcessor)
 {
     $compressor->getCompressCommandLine('path')->willReturn('compress path');
     $shellProcessor->process('compress path')->shouldBeCalled();
     $this->beConstructedWith($compressor, 'path', $shellProcessor);
     $this->execute();
 }
Ejemplo n.º 2
0
 function it_should_execute_the_database_dump_command(Database $database, ShellProcessor $shellProcessor)
 {
     $database->getDumpCommandLine('path')->willReturn('dump path');
     $shellProcessor->process('dump path')->shouldBeCalled();
     $this->beConstructedWith($database, 'path', $shellProcessor);
     $this->execute();
 }
Ejemplo n.º 3
0
 /**
  * @throws \BackupManager\ShellProcessing\ShellProcessFailed
  */
 public function execute()
 {
     return $this->shellProcessor->process($this->database->getDumpCommandLine($this->outputPath));
 }
Ejemplo n.º 4
0
<?php

use BackupManager\ShellProcessing\ShellProcessor;
use Blogator\Components\Backup\Databases\MySQLCommands;
use Blogator\Components\Backup\RelationalRepositoryBackup as Repo;
use Symfony\Component\Process\Process;
include __DIR__ . "/../vendor/autoload.php";
//$repo = new Repo(new MySQLCommands([
//    "host" => "localhost",
//    "port" => "3306",
//    "user" => "root",
//    "pass" => "root",
//    "database" => "BackupDatabase"
//]));
//
//$shell = new ShellProcessor(new Process(''));
//$shell->process($repo->put("backup.sql")->onlySchema());
//$shell->process($repo->put("backup.sql")->withData()->take());
//$shell->process($repo->put("backup.sql")->withNoData()->take());
//$shell->process($repo->put("backup.sql")->withData()->tables(['posts'])->take());
//$shell->process($repo->put("backup.sql")->withNoData()->tables(['posts'])->take());
//$shell->process($repo->put("backup.sql")->withData()->tables(['posts', 'users'])->take());
//$shell->process($repo->put("backup.sql")->withNoData()->tables(['posts', 'users'])->take());
//$shell->process($repo->put("backup.sql")->withData()->excludeTables(['posts'])->take());
//$shell->process($repo->put("backup.sql")->withNoData()->excludeTables(['posts'])->take());
//$shell->process($repo->put("backup.sql")->withNoData()->excludeTables(['posts', 'users'])->take());
//$shell->process($repo->put("backup.sql")->withData()->excludeTables(['posts', 'users'])->take());
$repo = new Repo(new MySQLCommands(["host" => "localhost", "port" => "3306", "user" => "root", "pass" => "root", "database" => "BackupDatabase"]));
$shell = new ShellProcessor(new Process(''));
$shell->process($repo->restore("backup.sql"));
Ejemplo n.º 5
0
 /**
  * @throws \BackupManager\ShellProcessing\ShellProcessFailed
  */
 public function execute()
 {
     return $this->shellProcessor->process($this->compressor->getCompressCommandLine($this->sourcePath));
 }
Ejemplo n.º 6
0
 /**
  * @throws \BackupManager\ShellProcessing\ShellProcessFailed
  */
 public function execute()
 {
     return $this->shellProcessor->process($this->database->getRestoreCommandLine($this->inputPath));
 }