@@ 121-141 (lines=21) @@ | ||
118 | static::assertEquals(CompressionFactory::TYPE_UNKNOWN, $this->findCompression->getCompression($file)); |
|
119 | } |
|
120 | ||
121 | public function testWhenTheProcessFailsAnExceptionIsThrownOnFindCompression() |
|
122 | { |
|
123 | $process = m::mock(Process::class)->makePartial(); |
|
124 | $process->shouldReceive('isSuccessful')->andReturn(false); |
|
125 | $process->shouldReceive('getCommandLine')->andReturn('cmd'); |
|
126 | $process->shouldReceive('getExitCode')->andReturn(1); |
|
127 | $process->shouldReceive('getExitCodeText')->andReturn('failed'); |
|
128 | $process->shouldReceive('getWorkingDirectory')->andReturn('bla'); |
|
129 | $process->shouldReceive('isOutputDisabled')->andReturn(true); |
|
130 | $process->shouldReceive('mustRun')->andThrow(new ProcessFailedException($process)); |
|
131 | ||
132 | $this->processFactory->shouldReceive('createProcess') |
|
133 | ->andReturn($process); |
|
134 | ||
135 | $file = new LocalFile(static::$dir . 'failed_find_encoding_process.test'); |
|
136 | $file->put('random stuff and things 2!'); |
|
137 | ||
138 | $this->expectException(ProcessFailedException::class); |
|
139 | ||
140 | $this->findCompression->getCompression($file); |
|
141 | } |
|
142 | ||
143 | public function testCanModifyCanModifyLocalFiles() |
|
144 | { |
@@ 88-108 (lines=21) @@ | ||
85 | static::assertEquals($utf8file->getEncoding(), $gzipFile->getEncoding()); |
|
86 | } |
|
87 | ||
88 | public function testWhenTheProcessFailsAnExceptionIsThrownOnFindEncoding() |
|
89 | { |
|
90 | $process = m::mock(Process::class)->makePartial(); |
|
91 | $process->shouldReceive('isSuccessful')->andReturn(false); |
|
92 | $process->shouldReceive('getCommandLine')->andReturn('cmd'); |
|
93 | $process->shouldReceive('getExitCode')->andReturn(1); |
|
94 | $process->shouldReceive('getExitCodeText')->andReturn('failed'); |
|
95 | $process->shouldReceive('getWorkingDirectory')->andReturn('bla'); |
|
96 | $process->shouldReceive('isOutputDisabled')->andReturn(true); |
|
97 | $process->shouldReceive('mustRun')->andThrow(new ProcessFailedException($process)); |
|
98 | ||
99 | $this->processFactory->shouldReceive('createProcess') |
|
100 | ->andReturn($process); |
|
101 | ||
102 | $file = new LocalFile(static::$dir . 'failed_find_encoding_process.test'); |
|
103 | $file->put('random stuff and things 2!'); |
|
104 | ||
105 | $this->expectException(ProcessFailedException::class); |
|
106 | ||
107 | $this->findEncoding->getEncoding($file); |
|
108 | } |
|
109 | ||
110 | public function testWhenTheProcessReturnsAnUnknownFileNullIsReturned() |
|
111 | { |