wiki.techinc.nl/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php
Kunal Mehta 6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00

43 lines
864 B
PHP

<?php
/**
* @group GlobalFunctions
* @covers ::wfEscapeShellArg
*/
class WfEscapeShellArgTest extends MediaWikiTestCase {
public function testSingleInput() {
if ( wfIsWindows() ) {
$expected = '"blah"';
} else {
$expected = "'blah'";
}
$actual = wfEscapeShellArg( 'blah' );
$this->assertEquals( $expected, $actual );
}
public function testMultipleArgs() {
if ( wfIsWindows() ) {
$expected = '"foo" "bar" "baz"';
} else {
$expected = "'foo' 'bar' 'baz'";
}
$actual = wfEscapeShellArg( 'foo', 'bar', 'baz' );
$this->assertEquals( $expected, $actual );
}
public function testMultipleArgsAsArray() {
if ( wfIsWindows() ) {
$expected = '"foo" "bar" "baz"';
} else {
$expected = "'foo' 'bar' 'baz'";
}
$actual = wfEscapeShellArg( [ 'foo', 'bar', 'baz' ] );
$this->assertEquals( $expected, $actual );
}
}