ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ProcessUtilsTest.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
13
15
17{
21 public function testEscapeArgument($result, $argument)
22 {
23 $this->assertSame($result, ProcessUtils::escapeArgument($argument));
24 }
25
26 public function dataArguments()
27 {
28 if ('\\' === DIRECTORY_SEPARATOR) {
29 return array(
30 array('"\"php\" \"-v\""', '"php" "-v"'),
31 array('"foo bar"', 'foo bar'),
32 array('^%"path"^%', '%path%'),
33 array('"<|>\\" \\"\'f"', '<|>" "\'f'),
34 array('""', ''),
35 array('"with\trailingbs\\\\"', 'with\trailingbs\\'),
36 );
37 }
38
39 return array(
40 array("'\"php\" \"-v\"'", '"php" "-v"'),
41 array("'foo bar'", 'foo bar'),
42 array("'%path%'", '%path%'),
43 array("'<|>\" \"'\\''f'", '<|>" "\'f'),
44 array("''", ''),
45 array("'with\\trailingbs\\'", 'with\trailingbs\\'),
46 );
47 }
48}
$result
An exception for terminatinating execution or to throw for unit testing.
ProcessUtils is a bunch of utility methods.
static escapeArgument($argument)
Escapes a string to be used as a shell argument.
testEscapeArgument($result, $argument)
@dataProvider dataArguments