/** * 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(); }