]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - vendor/symfony/process/Tests/ProcessUtilsTest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / symfony / process / Tests / ProcessUtilsTest.php
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
12 namespace Symfony\Component\Process\Tests;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Process\ProcessUtils;
16
17 class ProcessUtilsTest extends TestCase
18 {
19     /**
20      * @dataProvider dataArguments
21      */
22     public function testEscapeArgument($result, $argument)
23     {
24         $this->assertSame($result, ProcessUtils::escapeArgument($argument));
25     }
26
27     public function dataArguments()
28     {
29         if ('\\' === DIRECTORY_SEPARATOR) {
30             return array(
31                 array('"\"php\" \"-v\""', '"php" "-v"'),
32                 array('"foo bar"', 'foo bar'),
33                 array('^%"path"^%', '%path%'),
34                 array('"<|>\\" \\"\'f"', '<|>" "\'f'),
35                 array('""', ''),
36                 array('"with\trailingbs\\\\"', 'with\trailingbs\\'),
37             );
38         }
39
40         return array(
41             array("'\"php\" \"-v\"'", '"php" "-v"'),
42             array("'foo bar'", 'foo bar'),
43             array("'%path%'", '%path%'),
44             array("'<|>\" \"'\\''f'", '<|>" "\'f'),
45             array("''", ''),
46             array("'with\\trailingbs\\'", 'with\trailingbs\\'),
47             array("'withNonAsciiAccentLikeéÉèÈàÀöä'", 'withNonAsciiAccentLikeéÉèÈàÀöä'),
48         );
49     }
50 }