1 | <?php |
||
15 | trait CommandTestTrait |
||
16 | { |
||
17 | use ApplicationTestTrait, |
||
18 | CommandDependencyMockTrait; |
||
19 | |||
20 | /** |
||
21 | * @var Command |
||
22 | */ |
||
23 | protected $command; |
||
24 | |||
25 | /** @var CommandTester */ |
||
26 | protected $commandTester; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $arguments = []; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $argumentString; |
||
37 | |||
38 | /** |
||
39 | * @var \Throwable |
||
40 | */ |
||
41 | private $lastException; |
||
42 | |||
43 | /** |
||
44 | * @var int |
||
45 | */ |
||
46 | private $lastExitCode = 0; |
||
47 | |||
48 | /** |
||
49 | * @param Command $command |
||
50 | */ |
||
51 | public function setCommand(Command $command) |
||
65 | |||
66 | /** |
||
67 | * @return Command |
||
68 | */ |
||
69 | public function getCommand(): Command |
||
79 | |||
80 | /** |
||
81 | * @param CommandTester $commandTester |
||
82 | */ |
||
83 | protected function setCommandTester(CommandTester $commandTester) |
||
87 | |||
88 | /** |
||
89 | * @return CommandTester |
||
90 | */ |
||
91 | public function getCommandTester(): CommandTester |
||
95 | |||
96 | protected function resetCommand() |
||
103 | |||
104 | /** |
||
105 | * @param array $arguments |
||
106 | */ |
||
107 | public function setArguments(array $arguments) |
||
111 | |||
112 | /** |
||
113 | * @param string $name |
||
114 | * @param bool|string|int|float $value |
||
115 | */ |
||
116 | public function addArgument(string $name, $value) |
||
120 | |||
121 | /** |
||
122 | * @return array |
||
123 | */ |
||
124 | public function getArguments(): array |
||
128 | |||
129 | /** |
||
130 | * @param string $argumentString |
||
131 | */ |
||
132 | public function setArgumentString(string $argumentString) |
||
136 | |||
137 | /** |
||
138 | * @return string |
||
139 | */ |
||
140 | public function getArgumentString(): string |
||
146 | |||
147 | /** |
||
148 | * @param string $command |
||
149 | * @param null|string $namespace |
||
150 | * @return string |
||
151 | */ |
||
152 | protected function renderCommandName(string $command, ?string $namespace) |
||
162 | } |
||
163 | |||
164 |