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(); }
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(); }
/** * @throws \BackupManager\ShellProcessing\ShellProcessFailed */ public function execute() { return $this->shellProcessor->process($this->database->getDumpCommandLine($this->outputPath)); }
<?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"));
/** * @throws \BackupManager\ShellProcessing\ShellProcessFailed */ public function execute() { return $this->shellProcessor->process($this->compressor->getCompressCommandLine($this->sourcePath)); }
/** * @throws \BackupManager\ShellProcessing\ShellProcessFailed */ public function execute() { return $this->shellProcessor->process($this->database->getRestoreCommandLine($this->inputPath)); }