4use Wikimedia\TestingAccessWrapper;
12 $this->markTestSkipped(
'This test requires a POSIX environment.' );
19 public function testExecute( $commandInput, $expectedExitCode, $expectedOutput ) {
24 ->params( $commandInput )
27 $this->assertSame( $expectedExitCode, $result->getExitCode() );
28 $this->assertSame( $expectedOutput, $result->getStdout() );
33 'success status' => [
'true', 0,
'' ],
34 'failure status' => [
'false', 1,
'' ],
35 'output' => [ [
'echo',
'-n',
'x',
'>',
'y' ], 0,
'x > y' ],
44 ->params( [
'printenv',
'FOO' ] )
45 ->environment( [
'FOO' =>
'bar' ] )
47 $this->assertSame(
"bar\n", $result->getStdout() );
57 ->params( [
'ls',
"$IP/index.php" ] )
59 $this->assertSame(
"$IP/index.php", trim( $result->getStdout() ) );
63 ->params( [
'ls',
'index.php',
'no-such-file' ] )
66 $this->assertRegExp(
'/^.+no-such-file.*$/m', $result->getStdout() );
74 $command->params(
'echo',
'a',
null,
'b' );
75 $command->unsafeParams(
'c',
null,
'd' );
76 $this->assertEquals(
"'echo' 'a' 'b' c d",
$command->command );
82 ? (
'for /l %i in (1, 1, 1001) do @echo ' . str_repeat(
'*', 331 ) )
83 :
'printf "%-333333s" "*"';
86 for ( $i = 0; $i < 10; $i++ ) {
91 $this->assertEquals( 333333, strlen(
$output ) );
wfIsWindows()
Check if the operating system is Windows.
testNullsAreSkipped()
Test that null values are skipped by params() and unsafeParams()
testExecute( $commandInput, $expectedExitCode, $expectedOutput)
provideExecute
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place $output