| 1 |
<?php |
| 2 |
namespace ExecWithFallback\Tests; |
| 3 |
|
| 4 |
use PHPUnit\Framework\TestCase; |
| 5 |
|
| 6 |
use ExecWithFallback\ShellExec; |
| 7 |
|
| 8 |
class ShellExecTest extends BaseTest |
| 9 |
{ |
| 10 |
|
| 11 |
public $className = 'ShellExec'; |
| 12 |
public $supportsResultCode = false; |
| 13 |
|
| 14 |
public function isAvailable() |
| 15 |
{ |
| 16 |
return function_exists('shell_exec'); |
| 17 |
} |
| 18 |
|
| 19 |
public function runExec($command, &$output = null, &$result_code = null) |
| 20 |
{ |
| 21 |
if (func_num_args() == 3) { |
| 22 |
return ShellExec::exec($command, $output, $result_code); |
| 23 |
} else { |
| 24 |
return ShellExec::exec($command, $output); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
/* |
| 29 |
public function testCodeSupplied() |
| 30 |
{ |
| 31 |
if ($this->checkAvailability()) { |
| 32 |
$output = []; |
| 33 |
$execResult = $this->runExec('echo hi', $output, $return_code); |
| 34 |
$this->assertFalse($execResult); |
| 35 |
} |
| 36 |
}*/ |
| 37 |
|
| 38 |
} |
| 39 |
|