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