public setOptions ( array $options ) : static | ||
$options | array | array of name => value options that should be applied to the object You can also pass options that use a setter, e.g. you can pass a `fileName` option which will be passed to `setFileName()`. |
return | static | for method chaining |
public function testCanSetOptions() { $command = new Command(); $command->setOptions(array('command' => 'echo', 'escapeArgs' => false, 'procEnv' => array('TESTVAR' => 'test'), 'args' => '-n $TESTVAR')); $this->assertEquals('echo -n $TESTVAR', $command->getExecCommand()); $this->assertFalse($command->escapeArgs); $this->assertFalse($command->getExecuted()); $this->assertTrue($command->execute()); $this->assertTrue($command->getExecuted()); $this->assertEquals('test', $command->getOutput()); }