Add @covers for includes/shell/ tests
[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 public function testIsDisabled() {
11 $this->assertInternalType( 'bool', Shell::isDisabled() ); // sanity
12 }
13
14 /**
15 * @dataProvider provideEscape
16 */
17 public function testEscape( $args, $expected ) {
18 if ( wfIsWindows() ) {
19 $this->markTestSkipped( 'This test requires a POSIX environment.' );
20 }
21 $this->assertSame( $expected, call_user_func_array( [ Shell::class, 'escape' ], $args ) );
22 }
23
24 public function provideEscape() {
25 return [
26 'simple' => [ [ 'true' ], "'true'" ],
27 'with args' => [ [ 'convert', '-font', 'font name' ], "'convert' '-font' 'font name'" ],
28 'array' => [ [ [ 'convert', '-font', 'font name' ] ], "'convert' '-font' 'font name'" ],
29 'skip nulls' => [ [ 'ls', null ], "'ls'" ],
30 ];
31 }
32 }