[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <[email protected]> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\Console\Tester; 13 14 use Symfony\Component\Console\Command\Command; 15 use Symfony\Component\Console\Input\ArrayInput; 16 17 /** 18 * Eases the testing of console commands. 19 * 20 * @author Fabien Potencier <[email protected]> 21 * @author Robin Chalas <[email protected]> 22 */ 23 class CommandTester 24 { 25 use TesterTrait; 26 27 private $command; 28 29 public function __construct(Command $command) 30 { 31 $this->command = $command; 32 } 33 34 /** 35 * Executes the command. 36 * 37 * Available execution options: 38 * 39 * * interactive: Sets the input interactive flag 40 * * decorated: Sets the output decorated flag 41 * * verbosity: Sets the output verbosity flag 42 * * capture_stderr_separately: Make output of stdOut and stdErr separately available 43 * 44 * @param array $input An array of command arguments and options 45 * @param array $options An array of execution options 46 * 47 * @return int The command exit code 48 */ 49 public function execute(array $input, array $options = []) 50 { 51 // set the command name automatically if the application requires 52 // this argument and no command name was passed 53 if (!isset($input['command']) 54 && (null !== $application = $this->command->getApplication()) 55 && $application->getDefinition()->hasArgument('command') 56 ) { 57 $input = array_merge(['command' => $this->command->getName()], $input); 58 } 59 60 $this->input = new ArrayInput($input); 61 // Use an in-memory input stream even if no inputs are set so that QuestionHelper::ask() does not rely on the blocking STDIN. 62 $this->input->setStream(self::createStream($this->inputs)); 63 64 if (isset($options['interactive'])) { 65 $this->input->setInteractive($options['interactive']); 66 } 67 68 if (!isset($options['decorated'])) { 69 $options['decorated'] = false; 70 } 71 72 $this->initOutput($options); 73 74 return $this->statusCode = $this->command->run($this->input, $this->output); 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |