|
@@ 103-123 (lines=21) @@
|
| 100 |
|
$this->zip->decompress($file); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
public function testWhenTheProcessFailsAnExceptionIsthrownOnZip() |
| 104 |
|
{ |
| 105 |
|
$process = m::mock(Process::class)->makePartial(); |
| 106 |
|
$this->processFactory->shouldReceive('createProcess') |
| 107 |
|
->andReturn($process); |
| 108 |
|
$process->shouldReceive('run')->once(); |
| 109 |
|
$process->shouldReceive('isSuccessful')->once()->andReturn(false); |
| 110 |
|
$process->shouldReceive('getCommandLine')->andReturn(''); |
| 111 |
|
$process->shouldReceive('getExitCode')->andReturn(1); |
| 112 |
|
$process->shouldReceive('getExitCodeText')->andReturn('bla'); |
| 113 |
|
$process->shouldReceive('getWorkingDirectory')->andReturn('/something/'); |
| 114 |
|
$process->shouldReceive('isOutputDisabled')->andReturn('true'); |
| 115 |
|
|
| 116 |
|
$file = new LocalFile(static::$dir . 'failed_zip_process.test'); |
| 117 |
|
|
| 118 |
|
$file->put('random stuff and things 2!'); |
| 119 |
|
|
| 120 |
|
$this->expectException(ProcessFailedException::class); |
| 121 |
|
|
| 122 |
|
$this->zip->compress($file); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
public function testWhenTheProcessFailsAnExceptionIsthrownOnUnzip() |
| 126 |
|
{ |
|
@@ 125-145 (lines=21) @@
|
| 122 |
|
$this->zip->compress($file); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
public function testWhenTheProcessFailsAnExceptionIsthrownOnUnzip() |
| 126 |
|
{ |
| 127 |
|
$process = m::mock(Process::class)->makePartial(); |
| 128 |
|
$this->processFactory->shouldReceive('createProcess') |
| 129 |
|
->andReturn($process); |
| 130 |
|
$process->shouldReceive('run')->once(); |
| 131 |
|
$process->shouldReceive('isSuccessful')->once()->andReturn(false); |
| 132 |
|
$process->shouldReceive('getCommandLine')->andReturn(''); |
| 133 |
|
$process->shouldReceive('getExitCode')->andReturn(1); |
| 134 |
|
$process->shouldReceive('getExitCodeText')->andReturn('bla'); |
| 135 |
|
$process->shouldReceive('getWorkingDirectory')->andReturn('/something/'); |
| 136 |
|
$process->shouldReceive('isOutputDisabled')->andReturn('true'); |
| 137 |
|
|
| 138 |
|
$file = new LocalFile(static::$dir . 'failed_unzip_process.test'); |
| 139 |
|
|
| 140 |
|
$file->put('random stuff and things 2!'); |
| 141 |
|
|
| 142 |
|
$this->expectException(ProcessFailedException::class); |
| 143 |
|
|
| 144 |
|
$this->zip->decompress($file); |
| 145 |
|
} |
| 146 |
|
|
| 147 |
|
public function testPassingTheKeepOldFileOptionWillKeepTheFile() |
| 148 |
|
{ |