ProcessUtilsTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Process\Tests;
  11. use Symfony\Component\Process\ProcessUtils;
  12. class ProcessUtilsTest extends \PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @dataProvider dataArguments
  16. */
  17. public function testEscapeArgument($result, $argument)
  18. {
  19. $this->assertSame($result, ProcessUtils::escapeArgument($argument));
  20. }
  21. public function dataArguments()
  22. {
  23. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  24. return array(
  25. array('"foo bar"', 'foo bar'),
  26. array('^%"path"^%', '%path%'),
  27. array('"<|>"\\"" "\\""\'f"', '<|>" "\'f'),
  28. array('""', ''),
  29. );
  30. }
  31. return array(
  32. array("'foo bar'", 'foo bar'),
  33. array("'%path%'", '%path%'),
  34. array("'<|>\" \"'\\''f'", '<|>" "\'f'),
  35. array("''", ''),
  36. );
  37. }
  38. }