Merge "Skin: Make skins aware of their registered skin name"
[lhc/web/wiklou.git] / tests / phpunit / includes / shell / ShellTest.php
1 <?php
2
3 use MediaWiki\Shell\Shell;
4
5 /**
6 * @group Shell
7 */
8 class ShellTest extends PHPUnit_Framework_TestCase {
9 public function testIsDisabled() {
10 $this->assertInternalType( 'bool', Shell::isDisabled() ); // sanity
11 }
12
13 /**
14 * @dataProvider provideEscape
15 */
16 public function testEscape( $args, $expected ) {
17 if ( wfIsWindows() ) {
18 $this->markTestSkipped( 'This test requires a POSIX environment.' );
19 }
20 $this->assertSame( $expected, call_user_func_array( [ Shell::class, 'escape' ], $args ) );
21 }
22
23 public function provideEscape() {
24 return [
25 'simple' => [ [ 'true' ], "'true'" ],
26 'with args' => [ [ 'convert', '-font', 'font name' ], "'convert' '-font' 'font name'" ],
27 'array' => [ [ [ 'convert', '-font', 'font name' ] ], "'convert' '-font' 'font name'" ],
28 ];
29 }
30 }