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