Example #1
0
 /**
  * Tests File::compress
  *
  * @expectedException \phpbu\App\Exception
  */
 public function testCompressFail()
 {
     $dir = new File(__FILE__);
     $cliResult = $this->getCliResultMock(1, 'gzip');
     $target = $this->getTargetMock(__FILE__, __FILE__ . '.gz');
     $target->method('getCompressor')->willReturn($this->getCompressorMock('gzip', 'gz'));
     $appResult = $this->getAppResultMock();
     $gzip = $this->getMockBuilder('\\phpbu\\App\\Cli\\Executable\\Compressor')->disableOriginalConstructor()->getMock();
     $gzip->method('run')->willReturn($cliResult);
     $dir->setExecutable($gzip);
     $dir->compress($target, $appResult);
 }
Example #2
0
 /**
  * Compresses the target if the target is a single file.
  *
  * @param  \phpbu\App\Backup\Target $target
  * @param  \phpbu\App\Result        $result
  * @param  string                   $dataToCompress
  * @throws \phpbu\App\Exception
  */
 protected function compressFile(Target $target, Result $result, $dataToCompress)
 {
     $fileCompressor = new Compressor\File($dataToCompress);
     $fileCompressor->compress($target, $result);
 }