Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / tests / phpunit / includes / shell / ShellTest.php
1 <?php
2
3 use MediaWiki\Shell\Shell;
4
5 /**
6 * @covers \MediaWiki\Shell\Shell
7 * @group Shell
8 */
9 class ShellTest extends PHPUnit\Framework\TestCase {
10
11 use MediaWikiCoversValidator;
12
13 public function testIsDisabled() {
14 $this->assertInternalType( 'bool', Shell::isDisabled() ); // sanity
15 }
16
17 /**
18 * @dataProvider provideEscape
19 */
20 public function testEscape( $args, $expected ) {
21 if ( wfIsWindows() ) {
22 $this->markTestSkipped( 'This test requires a POSIX environment.' );
23 }
24 $this->assertSame( $expected, call_user_func_array( [ Shell::class, 'escape' ], $args ) );
25 }
26
27 public function provideEscape() {
28 return [
29 'simple' => [ [ 'true' ], "'true'" ],
30 'with args' => [ [ 'convert', '-font', 'font name' ], "'convert' '-font' 'font name'" ],
31 'array' => [ [ [ 'convert', '-font', 'font name' ] ], "'convert' '-font' 'font name'" ],
32 'skip nulls' => [ [ 'ls', null ], "'ls'" ],
33 ];
34 }
35 }