wiki.techinc.nl/tests/phpunit/includes/shell/ShellTest.php
Kunal Mehta 75160bdd3b Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCase
Change-Id: I8c4de7e9c72c9969088666007b54c6fd23f6cc13
2018-01-01 08:28:02 +00:00

35 lines
907 B
PHP

<?php
use MediaWiki\Shell\Shell;
/**
* @covers \MediaWiki\Shell\Shell
* @group Shell
*/
class ShellTest extends PHPUnit_Framework_TestCase {
use MediaWikiCoversValidator;
public function testIsDisabled() {
$this->assertInternalType( 'bool', Shell::isDisabled() ); // sanity
}
/**
* @dataProvider provideEscape
*/
public function testEscape( $args, $expected ) {
if ( wfIsWindows() ) {
$this->markTestSkipped( 'This test requires a POSIX environment.' );
}
$this->assertSame( $expected, call_user_func_array( [ Shell::class, 'escape' ], $args ) );
}
public function provideEscape() {
return [
'simple' => [ [ 'true' ], "'true'" ],
'with args' => [ [ 'convert', '-font', 'font name' ], "'convert' '-font' 'font name'" ],
'array' => [ [ [ 'convert', '-font', 'font name' ] ], "'convert' '-font' 'font name'" ],
'skip nulls' => [ [ 'ls', null ], "'ls'" ],
];
}
}