public function getCommandProvider() { if (OS::isWindows()) { return [['""', []], ['""', ['']], ['foo', ['foo']], ['foo bar', ['foo', 'bar']], ['foo "bar bar"', ['foo', 'bar bar']], ['foo "bar\\"bar"', ['foo', 'bar"bar']], ['"foo bar.exe"', ['foo bar.exe']], ['foo.exe "test\\\\"', ['foo.exe', 'test\\']], ['child.exe argument1 "argument 2" "\\some\\path with\\spaces"', ['child.exe', 'argument1', 'argument 2', '\\some\\path with\\spaces']], ['child.exe argument1 "she said, \\"you had me at hello\\"" "\\some\\path with\\spaces"', ['child.exe', 'argument1', 'she said, "you had me at hello"', '\\some\\path with\\spaces']], ['child.exe argument1 "argument\\"2" argument3 argument4', ['child.exe', 'argument1', 'argument"2', 'argument3', 'argument4']], ['child.exe "\\some\\directory with\\spaces\\\\" argument2', ['child.exe', '\\some\\directory with\\spaces\\', 'argument2']]]; } return [["''", []], ["''", ['']], ['foo', ['foo']], ['foo bar', ['foo', 'bar']], ["foo 'bar bar'", ['foo', 'bar bar']], ["'foo bar'", ['foo bar']], ["foo 'test\\'", ['foo', 'test\\']], ['foo -x bar', ['foo', '-x', 'bar']], ['foo --bar x', ['foo', '--bar', 'x']], ["foo '--' x", ['foo', '--', 'x']]]; }
public function testLocalize() { if (OS::isWindows()) { $this->assertSame('a\\b', Path::localize('a/b')); $this->assertSame('a\\b', Path::localize('a\\b')); } else { $this->assertSame('a/b', Path::localize('a\\b')); $this->assertSame('a/b', Path::localize('a/b')); } }
/** * @dataProvider isWindowsProvider * * @param bool $expected * @param string $phpOs */ public function testIsWindows($expected, $phpOs) { $this->assertSame($expected, OS::isWindows($phpOs)); }