tests/integration/Modify/Compress/FindCompressionTest.php 1 location
|
@@ 103-116 (lines=14) @@
|
100 |
|
static::assertEquals(Zip::NAME, $zipFile->getCompression()); |
101 |
|
} |
102 |
|
|
103 |
|
public function testWhenTheProcessReturnsAnUnknownCompressionUnknownTypeIsReturned() |
104 |
|
{ |
105 |
|
$process = m::mock(Process::class)->makePartial(); |
106 |
|
$process->shouldReceive('mustRun'); |
107 |
|
$process->shouldReceive('getOutput') |
108 |
|
->andReturn( |
109 |
|
'text/plain; charset=utf-8 compressed-encoding=application/lzop; charset=binary; charset=binary' |
110 |
|
); |
111 |
|
|
112 |
|
$this->processFactory->shouldReceive('createProcess') |
113 |
|
->andReturn($process); |
114 |
|
|
115 |
|
$file = new LocalFile(static::$dir . 'unknown_compression.test'); |
116 |
|
$file->put('random stuff and things 2!'); |
117 |
|
|
118 |
|
static::assertEquals(CompressionFactory::TYPE_UNKNOWN, $this->findCompression->getCompression($file)); |
119 |
|
} |
tests/integration/Modify/Contract/MergeFilesTest.php 1 location
|
@@ 252-268 (lines=17) @@
|
249 |
|
static::assertCount(0, $exists); |
250 |
|
} |
251 |
|
|
252 |
|
public function testProcessFailedThrowException() |
253 |
|
{ |
254 |
|
$process = m::mock('Symfony\Component\Process\Process')->makePartial(); |
255 |
|
$this->processFactory->shouldReceive('createProcess') |
256 |
|
->andReturn($process); |
257 |
|
|
258 |
|
$process->shouldReceive('isSuccessful')->andReturn(false); |
259 |
|
|
260 |
|
// set exception as no guarantee process will run on local system |
261 |
|
$this->expectException(ProcessFailedException::class); |
262 |
|
|
263 |
|
$collection = $this->createCollection('simple.merge/', 3); |
264 |
|
|
265 |
|
$outputFile = new LocalFile(static::$dir . 'simple.merge.output'); |
266 |
|
|
267 |
|
$this->merge->contract($collection, $outputFile); |
268 |
|
} |
269 |
|
|
270 |
|
public function testCallingContractWillPassThroughOptions() |
271 |
|
{ |
tests/integration/Modify/Encoding/FindEncodingTest.php 1 location
|
@@ 110-123 (lines=14) @@
|
107 |
|
$this->findEncoding->getEncoding($file); |
108 |
|
} |
109 |
|
|
110 |
|
public function testWhenTheProcessReturnsAnUnknownFileNullIsReturned() |
111 |
|
{ |
112 |
|
$process = m::mock(Process::class)->makePartial(); |
113 |
|
$process->shouldReceive('mustRun'); |
114 |
|
$process->shouldReceive('getOutput')->andReturn('some random stuff with no charset'); |
115 |
|
|
116 |
|
$this->processFactory->shouldReceive('createProcess') |
117 |
|
->andReturn($process); |
118 |
|
|
119 |
|
$file = new LocalFile(static::$dir . 'unknown_compression.test'); |
120 |
|
$file->put('random stuff and things 2!'); |
121 |
|
|
122 |
|
static::assertNull($this->findEncoding->getEncoding($file)); |
123 |
|
} |
124 |
|
|
125 |
|
public function testCanModifyCanModifyLocalFiles() |
126 |
|
{ |
tests/integration/Modify/HeadTest.php 1 location
|
@@ 228-241 (lines=14) @@
|
225 |
|
$this->head->modify($file, ['lines' => 1]); |
226 |
|
} |
227 |
|
|
228 |
|
public function testWhenTheProcessFailsAnExceptionIsThrownOnFindEncoding() |
229 |
|
{ |
230 |
|
$process = m::mock(Process::class)->makePartial(); |
231 |
|
$process->shouldReceive('isSuccessful')->andReturn(false); |
232 |
|
$this->processFactory->shouldReceive('createProcess') |
233 |
|
->andReturn($process); |
234 |
|
|
235 |
|
$file = new LocalFile(static::$dir . 'failed_tail.test'); |
236 |
|
$file->put('nothing interesting here'); |
237 |
|
|
238 |
|
$this->expectException(ProcessFailedException::class); |
239 |
|
|
240 |
|
$this->head->head($file, 3); |
241 |
|
} |
242 |
|
} |
243 |
|
|
tests/integration/Modify/ReplaceTextTest.php 1 location
|
@@ 219-232 (lines=14) @@
|
216 |
|
static::assertEquals(['some pants that pants should be replaced'], $newFile->getContents()); |
217 |
|
} |
218 |
|
|
219 |
|
public function testWhenTheProcessFailsAnExceptionIsThrownOnFindEncoding() |
220 |
|
{ |
221 |
|
$process = m::mock(Process::class)->makePartial(); |
222 |
|
$process->shouldReceive('isSuccessful')->andReturn(false); |
223 |
|
$this->processFactory->shouldReceive('createProcess') |
224 |
|
->andReturn($process); |
225 |
|
|
226 |
|
$file = new LocalFile(static::$dir . 'failed_replace_text.test'); |
227 |
|
$file->put('some text that text should be replaced'); |
228 |
|
|
229 |
|
$this->expectException(ProcessFailedException::class); |
230 |
|
|
231 |
|
$this->replacer->replaceText($file, 'text', 'pants'); |
232 |
|
} |
233 |
|
} |
234 |
|
|
tests/integration/Modify/TailTest.php 1 location
|
@@ 229-242 (lines=14) @@
|
226 |
|
$this->tail->modify($file, ['lines' => 1]); |
227 |
|
} |
228 |
|
|
229 |
|
public function testWhenTheProcessFailsAnExceptionIsThrownOnFindEncoding() |
230 |
|
{ |
231 |
|
$process = m::mock(Process::class)->makePartial(); |
232 |
|
$process->shouldReceive('isSuccessful')->andReturn(false); |
233 |
|
$this->processFactory->shouldReceive('createProcess') |
234 |
|
->andReturn($process); |
235 |
|
|
236 |
|
$file = new LocalFile(static::$dir . 'failed_tail.test'); |
237 |
|
$file->put('nothing interesting here'); |
238 |
|
|
239 |
|
$this->expectException(ProcessFailedException::class); |
240 |
|
|
241 |
|
$this->tail->tail($file, 3); |
242 |
|
} |
243 |
|
} |
244 |
|
|