コード例 #1
0
 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();
 }
コード例 #2
0
 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?
 }
コード例 #3
0
 public function testDetectEnvironmentError()
 {
     $this->setExpectedException('\\RuntimeException', 'Unable to find Environment for OS "foobar".');
     $builder = new CommandBuilder();
     $builder->getEnvironment('foobar');
 }