public function testInvalidCommand() { $this->skipIfNotUnix(); $this->setExpectedException('\\RuntimeException', 'Invalid command "foobar" provided to ptlis\\ShellCommand\\CommandBuilder.'); $builder = new CommandBuilder(new UnixEnvironment()); $builder->setCommand('foobar')->buildCommand(); }
public function testAddMultipleLogger() { $builder = new CommandBuilder(new MockEnvironment()); $logger = new MockPsrLogger(); $command = $builder->addArgument('test')->setCommand('./tests/commands/unix/test_binary')->addProcessObserver(new AllLogger($logger))->addProcessObserver(new NullProcessObserver($logger))->buildCommand(); $this->assertInstanceOf('ptlis\\ShellCommand\\Logger\\AggregateLogger', \PHPUnit_Framework_TestCase::readAttribute($command, 'processObserver')); // Todo test internals of AggregateLogger? }
public function testDetectEnvironmentError() { $this->setExpectedException('\\RuntimeException', 'Unable to find Environment for OS "foobar".'); $builder = new CommandBuilder(); $builder->getEnvironment('foobar'); }