Separate MediaWiki unit and integration tests
[lhc/web/wiklou.git] / tests / phpunit / unit / includes / GlobalFunctions / wfShellExecTest.php
1 <?php
2
3 /**
4 * @group GlobalFunctions
5 * @covers ::wfShellExec
6 */
7 class WfShellExecTest extends \MediaWikiUnitTestCase {
8 public function testT69870() {
9 $command = wfIsWindows()
10 // 333 = 331 + CRLF
11 ? ( 'for /l %i in (1, 1, 1001) do @echo ' . str_repeat( '*', 331 ) )
12 : 'printf "%-333333s" "*"';
13
14 // Test several times because it involves a race condition that may randomly succeed or fail
15 for ( $i = 0; $i < 10; $i++ ) {
16 $output = wfShellExec( $command );
17 $this->assertEquals( 333333, strlen( $output ) );
18 }
19 }
20 }