3 use MediaWiki\Shell\Shell
;
6 * @covers \MediaWiki\Shell\Shell
9 class ShellTest
extends PHPUnit\Framework\TestCase
{
11 use MediaWikiCoversValidator
;
13 public function testIsDisabled() {
14 $this->assertInternalType( 'bool', Shell
::isDisabled() ); // sanity
18 * @dataProvider provideEscape
20 public function testEscape( $args, $expected ) {
21 if ( wfIsWindows() ) {
22 $this->markTestSkipped( 'This test requires a POSIX environment.' );
24 $this->assertSame( $expected, call_user_func_array( [ Shell
::class, 'escape' ], $args ) );
27 public function provideEscape() {
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'" ],