ExecutionFailureExceptionTest.php 996 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Alchemy\Tests\BinaryDriver\Exceptions;
  3. use Alchemy\BinaryDriver\BinaryDriverTestCase;
  4. use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
  5. use Alchemy\BinaryDriver\ProcessRunner;
  6. class ExecutionFailureExceptionTest extends BinaryDriverTestCase
  7. {
  8. public function getProcessRunner($logger)
  9. {
  10. return new ProcessRunner($logger, 'test-runner');
  11. }
  12. public function testGetExceptionInfo(){
  13. $logger = $this->createLoggerMock();
  14. $runner = $this->getProcessRunner($logger);
  15. $process = $this->createProcessMock(1, false, '--helloworld--', null, "Error Output", true);
  16. try{
  17. $runner->run($process, new \SplObjectStorage(), false);
  18. $this->fail('An exception should have been raised');
  19. }
  20. catch (ExecutionFailureException $e){
  21. $this->assertEquals("--helloworld--", $e->getCommand());
  22. $this->assertEquals("Error Output", $e->getErrorOutput());
  23. }
  24. }
  25. }