MediaWiki
REL1_31
wfEscapeShellArgTest.php
Go to the documentation of this file.
1
<?php
2
7
class
WfEscapeShellArgTest
extends
MediaWikiTestCase
{
8
public
function
testSingleInput
() {
9
if
(
wfIsWindows
() ) {
10
$expected =
'"blah"'
;
11
}
else
{
12
$expected =
"'blah'"
;
13
}
14
15
$actual =
wfEscapeShellArg
(
'blah'
);
16
17
$this->assertEquals( $expected, $actual );
18
}
19
20
public
function
testMultipleArgs
() {
21
if
(
wfIsWindows
() ) {
22
$expected =
'"foo" "bar" "baz"'
;
23
}
else
{
24
$expected =
"'foo' 'bar' 'baz'"
;
25
}
26
27
$actual =
wfEscapeShellArg
(
'foo'
,
'bar'
,
'baz'
);
28
29
$this->assertEquals( $expected, $actual );
30
}
31
32
public
function
testMultipleArgsAsArray
() {
33
if
(
wfIsWindows
() ) {
34
$expected =
'"foo" "bar" "baz"'
;
35
}
else
{
36
$expected =
"'foo' 'bar' 'baz'"
;
37
}
38
39
$actual =
wfEscapeShellArg
( [
'foo'
,
'bar'
,
'baz'
] );
40
41
$this->assertEquals( $expected, $actual );
42
}
43
}
wfEscapeShellArg
wfEscapeShellArg()
Version of escapeshellarg() that works better on Windows.
Definition
GlobalFunctions.php:2209
wfIsWindows
wfIsWindows()
Check if the operating system is Windows.
Definition
GlobalFunctions.php:2019
MediaWikiTestCase
Definition
MediaWikiTestCase.php:17
WfEscapeShellArgTest
GlobalFunctions wfEscapeShellArg.
Definition
wfEscapeShellArgTest.php:7
WfEscapeShellArgTest\testMultipleArgs
testMultipleArgs()
Definition
wfEscapeShellArgTest.php:20
WfEscapeShellArgTest\testSingleInput
testSingleInput()
Definition
wfEscapeShellArgTest.php:8
WfEscapeShellArgTest\testMultipleArgsAsArray
testMultipleArgsAsArray()
Definition
wfEscapeShellArgTest.php:32
tests
phpunit
includes
GlobalFunctions
wfEscapeShellArgTest.php
Generated on Mon Nov 25 2024 15:36:23 for MediaWiki by
1.10.0