20 $_ENV[
'MY_VAR_1'] =
'foo';
26 unset($_ENV[
'MY_VAR_1']);
28 $env = $proc->getEnv();
29 $this->assertArrayHasKey(
'MY_VAR_1', $env);
30 $this->assertEquals(
'foo', $env[
'MY_VAR_1']);
42 ->setEnv(
'foo',
'bar2')
43 ->addEnvironmentVariables($env)
44 ->inheritEnvironmentVariables(
false)
48 $this->assertSame($env, $proc->getEnv());
53 $_ENV[
'MY_VAR_1'] =
'foo';
56 ->setEnv(
'MY_VAR_1',
'bar')
60 unset($_ENV[
'MY_VAR_1']);
62 $env = $proc->getEnv();
63 $this->assertArrayHasKey(
'MY_VAR_1', $env);
64 $this->assertEquals(
'bar', $env[
'MY_VAR_1']);
80 $pb->setTimeout(null);
82 $r = new \ReflectionObject($pb);
83 $p =
$r->getProperty(
'timeout');
84 $p->setAccessible(
true);
86 $this->assertNull($p->getValue($pb));
92 $pb->setArguments(
array(
'second'));
94 $proc = $pb->getProcess();
96 $this->assertContains(
'second', $proc->getCommandLine());
102 $pb->setPrefix(
'/usr/bin/php');
104 $proc = $pb->setArguments(
array(
'-v'))->getProcess();
105 if (
'\\' === DIRECTORY_SEPARATOR) {
106 $this->assertEquals(
'"/usr/bin/php" "-v"', $proc->getCommandLine());
108 $this->assertEquals(
"'/usr/bin/php' '-v'", $proc->getCommandLine());
111 $proc = $pb->setArguments(
array(
'-i'))->getProcess();
112 if (
'\\' === DIRECTORY_SEPARATOR) {
113 $this->assertEquals(
'"/usr/bin/php" "-i"', $proc->getCommandLine());
115 $this->assertEquals(
"'/usr/bin/php' '-i'", $proc->getCommandLine());
122 $pb->setPrefix(
array(
'/usr/bin/php',
'composer.phar'));
124 $proc = $pb->setArguments(
array(
'-v'))->getProcess();
125 if (
'\\' === DIRECTORY_SEPARATOR) {
126 $this->assertEquals(
'"/usr/bin/php" "composer.phar" "-v"', $proc->getCommandLine());
128 $this->assertEquals(
"'/usr/bin/php' 'composer.phar' '-v'", $proc->getCommandLine());
131 $proc = $pb->setArguments(
array(
'-i'))->getProcess();
132 if (
'\\' === DIRECTORY_SEPARATOR) {
133 $this->assertEquals(
'"/usr/bin/php" "composer.phar" "-i"', $proc->getCommandLine());
135 $this->assertEquals(
"'/usr/bin/php' 'composer.phar' '-i'", $proc->getCommandLine());
142 $proc = $pb->getProcess();
144 if (
'\\' === DIRECTORY_SEPARATOR) {
145 $this->assertSame(
'^%"path"^% "foo \\" bar" "%baz%baz"', $proc->getCommandLine());
147 $this->assertSame(
"'%path%' 'foo \" bar' '%baz%baz'", $proc->getCommandLine());
154 $pb->setPrefix(
'%prefix%');
155 $proc = $pb->getProcess();
157 if (
'\\' === DIRECTORY_SEPARATOR) {
158 $this->assertSame(
'^%"prefix"^% "arg"', $proc->getCommandLine());
160 $this->assertSame(
"'%prefix%' 'arg'", $proc->getCommandLine());
175 ->setPrefix(
'/usr/bin/php')
178 if (
'\\' === DIRECTORY_SEPARATOR) {
179 $this->assertEquals(
'"/usr/bin/php"', $process->getCommandLine());
181 $this->assertEquals(
"'/usr/bin/php'", $process->getCommandLine());
190 if (
'\\' === DIRECTORY_SEPARATOR) {
191 $this->assertEquals(
'"/usr/bin/php"', $process->getCommandLine());
193 $this->assertEquals(
"'/usr/bin/php'", $process->getCommandLine());
203 $this->assertTrue($process->isOutputDisabled());
213 $this->assertFalse($process->isOutputDisabled());
testShouldEscapeArgumentsAndPrefix()
static create(array $arguments=array())
Creates a process builder instance.
testShouldThrowALogicExceptionIfNoPrefixAndNoArgument()
testArrayPrefixesArePrependedToAllGeneratedProcess()
testNegativeTimeoutFromSetter()
testInheritEnvironmentVars()
testAddEnvironmentVariables()
testShouldReturnProcessWithDisabledOutput()
Create styles array
The data for the language used.
testInvalidInput()
Symfony::setInput only accepts strings, Traversable objects or stream resources.
testShouldNotThrowALogicExceptionIfNoPrefix()
testPrefixIsPrependedToAllGeneratedProcess()
testShouldEscapeArguments()
testShouldReturnProcessWithEnabledOutput()
testShouldNotThrowALogicExceptionIfNoArgument()
testProcessShouldInheritAndOverrideEnvironmentVars()