aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php
diff options
context:
space:
mode:
authorLegoktm <legoktm@member.fsf.org>2019-06-13 23:00:08 +0000
committerLegoktm <legoktm@member.fsf.org>2019-06-13 23:00:08 +0000
commit4e35134f7a3228a8195a07f49c85188e57ab8487 (patch)
treed9750a18496af4c52eb5dfce56f0d0b79fbd32cb /tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php
parent0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9 (diff)
downloadmediawikicore-4e35134f7a3228a8195a07f49c85188e57ab8487.tar.gz
mediawikicore-4e35134f7a3228a8195a07f49c85188e57ab8487.zip
Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9. Reason for revert: Broke postgres tests. Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
Diffstat (limited to 'tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php')
-rw-r--r--tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php b/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php
new file mode 100644
index 000000000000..7402054ea40b
--- /dev/null
+++ b/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php
@@ -0,0 +1,43 @@
+<?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 );
+ }
+}