/** * Saves the files into the extraction directory */ public function extract() { $this->shell->exec($this->getCommand()); if ($this->shell->getStatusCode() != 0) { throw new ExtractionFailureException("The backup of database '{$this->database}' could not be created. " . $this->shell->getOutput()); } $this->extractedFiles[] = $this->extractedFile; }
function it_throws_an_exception_if_the_extraction_failed(Shell $shell) { $shell->getStatusCode()->shouldBeCalled()->willReturn(1); $shell->getOutput()->shouldBeCalled()->willReturn(''); $shell->exec($this->getCommand())->shouldBeCalled(); $this->beConstructedWith($this->getValidConfig(), $shell); $this->setExtractionDir(__DIR__); $this->shouldThrow('Dimsav\\Backup\\Element\\Exceptions\\ExtractionFailureException')->duringExtract(); }
function it_uploads_the_file_to_dropbox_to_the_selected_destination(Shell $shell) { $this->makeToken(); $command = $this->uploaderPath() . $this->getScriptConfig() . ' upload ' . __FILE__ . ' /Backups/project_name/' . basename(__FILE__); $config = $this->getConfig(); $config['destination'] = '/Backups'; $shell->exec($command)->shouldBeCalled(); $this->beConstructedWith($config, $shell); $this->store(__FILE__, 'project_name'); }
public function store($file, $projectName = null) { $this->validate(); $this->validateFile($file); $this->shell->exec($this->getCommand($file, $projectName)); }