PluginProbe
Depicter — Popup & Slider Builder / 1.3.3
Depicter — Popup & Slider Builder v1.3.3
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / symfony / console / Tester / CommandTester.php

CommandTester.php in Depicter — Popup & Slider Builder 1.3.3, at vendor/symfony/console/Tester/CommandTester.php

79 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
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 <fabien@symfony.com>
21 * @author Robin Chalas <robin.chalas@gmail.com>
22 */
23 class CommandTester
24 {
25 use TesterTrait;
26
27 private $command;
28 private $input;
29 private $statusCode;
30
31 public function __construct(Command $command)
32 {
33 $this->command = $command;
34 }
35
36 /**
37 * Executes the command.
38 *
39 * Available execution options:
40 *
41 * * interactive: Sets the input interactive flag
42 * * decorated: Sets the output decorated flag
43 * * verbosity: Sets the output verbosity flag
44 * * capture_stderr_separately: Make output of stdOut and stdErr separately available
45 *
46 * @param array $input An array of command arguments and options
47 * @param array $options An array of execution options
48 *
49 * @return int The command exit code
50 */
51 public function execute(array $input, array $options = [])
52 {
53 // set the command name automatically if the application requires
54 // this argument and no command name was passed
55 if (!isset($input['command'])
56 && (null !== $application = $this->command->getApplication())
57 && $application->getDefinition()->hasArgument('command')
58 ) {
59 $input = array_merge(['command' => $this->command->getName()], $input);
60 }
61
62 $this->input = new ArrayInput($input);
63 // Use an in-memory input stream even if no inputs are set so that QuestionHelper::ask() does not rely on the blocking STDIN.
64 $this->input->setStream(self::createStream($this->inputs));
65
66 if (isset($options['interactive'])) {
67 $this->input->setInteractive($options['interactive']);
68 }
69
70 if (!isset($options['decorated'])) {
71 $options['decorated'] = false;
72 }
73
74 $this->initOutput($options);
75
76 return $this->statusCode = $this->command->run($this->input, $this->output);
77 }
78 }
79