Changeset View
Changeset View
Standalone View
Standalone View
src/future/exec/__tests__/ExecFutureTestCase.php
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | public function testMultipleResolves() { | ||||
$future = new ExecFuture('php -f %R -- quack', $bin); | $future = new ExecFuture('php -f %R -- quack', $bin); | ||||
$future->resolve(); | $future->resolve(); | ||||
$future->resolvex(); | $future->resolvex(); | ||||
list($err) = $future->resolveKill(); | list($err) = $future->resolveKill(); | ||||
$this->assertEqual(0, $err); | $this->assertEqual(0, $err); | ||||
} | } | ||||
public function testEscaping() { | |||||
$inputs = array( | |||||
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', | |||||
'!@#$%^&*()-=_+`~,.<>/?[]{};\':"|', | |||||
'', | |||||
' ', | |||||
'x y', | |||||
'%PATH%', | |||||
'"', | |||||
'""', | |||||
'a "b" c', | |||||
'\\', | |||||
'\\a', | |||||
'a\\', | |||||
'\\a\\', | |||||
'a\\a', | |||||
'\\\\', | |||||
'\\"', | |||||
); | |||||
$bin = $this->getSupportExecutable('echo'); | |||||
foreach ($inputs as $input) { | |||||
if (!is_array($input)) { | |||||
$input = array($input); | |||||
} | |||||
list($stdout) = execx( | |||||
'php -f %R -- %Ls', | |||||
$bin, | |||||
$input); | |||||
$stdout = explode("\n", $stdout); | |||||
$output = array(); | |||||
foreach ($stdout as $line) { | |||||
$output[] = stripcslashes($line); | |||||
} | |||||
$this->assertEqual( | |||||
$input, | |||||
$output, | |||||
pht( | |||||
'Arguments are preserved for input: %s', | |||||
implode(' ', $input))); | |||||
} | |||||
} | |||||
public function testReadBuffering() { | public function testReadBuffering() { | ||||
$str_len_8 = 'abcdefgh'; | $str_len_8 = 'abcdefgh'; | ||||
$str_len_4 = 'abcd'; | $str_len_4 = 'abcd'; | ||||
// This is a write/read with no read buffer. | // This is a write/read with no read buffer. | ||||
$future = $this->newCat(); | $future = $this->newCat(); | ||||
$future->write($str_len_8); | $future->write($str_len_8); | ||||
Show All 36 Lines |