Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / wfEscapeShellArgTest.php
blob7402054ea40bb3ecc595ad7862fde014ae8a596c
1 <?php
3 /**
4 * @group GlobalFunctions
5 * @covers ::wfEscapeShellArg
6 */
7 class WfEscapeShellArgTest extends MediaWikiTestCase {
8 public function testSingleInput() {
9 if ( wfIsWindows() ) {
10 $expected = '"blah"';
11 } else {
12 $expected = "'blah'";
15 $actual = wfEscapeShellArg( 'blah' );
17 $this->assertEquals( $expected, $actual );
20 public function testMultipleArgs() {
21 if ( wfIsWindows() ) {
22 $expected = '"foo" "bar" "baz"';
23 } else {
24 $expected = "'foo' 'bar' 'baz'";
27 $actual = wfEscapeShellArg( 'foo', 'bar', 'baz' );
29 $this->assertEquals( $expected, $actual );
32 public function testMultipleArgsAsArray() {
33 if ( wfIsWindows() ) {
34 $expected = '"foo" "bar" "baz"';
35 } else {
36 $expected = "'foo' 'bar' 'baz'";
39 $actual = wfEscapeShellArg( [ 'foo', 'bar', 'baz' ] );
41 $this->assertEquals( $expected, $actual );