12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace Symfony\Component\Console\Tester;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Input\ArrayInput;
- class ApplicationTester
- {
- use TesterTrait;
- private $application;
- public function __construct(Application $application)
- {
- $this->application = $application;
- }
-
- public function run(array $input, array $options = [])
- {
- $prevShellVerbosity = getenv('SHELL_VERBOSITY');
- try {
- $this->input = new ArrayInput($input);
- if (isset($options['interactive'])) {
- $this->input->setInteractive($options['interactive']);
- }
- if ($this->inputs) {
- $this->input->setStream(self::createStream($this->inputs));
- }
- $this->initOutput($options);
- return $this->statusCode = $this->application->run($this->input, $this->output);
- } finally {
-
-
- if (false === $prevShellVerbosity) {
- if (\function_exists('putenv')) {
- @putenv('SHELL_VERBOSITY');
- }
- unset($_ENV['SHELL_VERBOSITY']);
- unset($_SERVER['SHELL_VERBOSITY']);
- } else {
- if (\function_exists('putenv')) {
- @putenv('SHELL_VERBOSITY='.$prevShellVerbosity);
- }
- $_ENV['SHELL_VERBOSITY'] = $prevShellVerbosity;
- $_SERVER['SHELL_VERBOSITY'] = $prevShellVerbosity;
- }
- }
- }
- }
|