| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class ProcessFailedExceptionTest extends TestCase |
||
| 11 | { |
||
| 12 | public function testSymfonyRunningProcessFailedException(): void |
||
| 13 | { |
||
| 14 | $process = new Process('non_existing_binaries'); |
||
| 15 | |||
| 16 | try { |
||
| 17 | $process->mustRun(); |
||
| 18 | } catch (ExceptionInterface $exception) { |
||
| 19 | $processFailure = new ProcessFailedException($process, $exception); |
||
| 20 | $this->assertSame( |
||
| 21 | 'Process with command "non_existing_binaries" has failed running with exit code 127(Command not found)', |
||
| 22 | $processFailure->getMessage() |
||
| 23 | ); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | public function testSymfonyBootingProcessFailedException(): void |
||
| 28 | { |
||
| 29 | $process = new Process('echo test', __DIR__ . '/notfound/'); |
||
| 30 | |||
| 31 | try { |
||
| 32 | $process->mustRun(); |
||
| 33 | } catch (ExceptionInterface $exception) { |
||
| 34 | $processFailure = new ProcessFailedException($process, $exception); |
||
| 35 | $this->assertSame( |
||
| 36 | 'Process with command "echo test" has failed with exit code 0()', |
||
| 37 | $processFailure->getMessage() |
||
| 38 | ); |
||
| 39 | |||
| 40 | return; |
||
| 41 | } |
||
| 42 | |||
| 43 | $this->markTestSkipped('Test is only relevant for symfony/process: ^4.0'); |
||
| 44 | } |
||
| 46 |