1 | <?php |
||
11 | class CommandContext extends Context |
||
12 | { |
||
13 | /** |
||
14 | * @var StreamOutput |
||
15 | */ |
||
16 | private $output; |
||
17 | |||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | private $exitCode; |
||
22 | |||
23 | /** |
||
24 | * @var \Exception |
||
25 | */ |
||
26 | private $exception; |
||
27 | |||
28 | /** |
||
29 | * @var Application |
||
30 | */ |
||
31 | private $application; |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | * |
||
36 | * @throws \LogicException You must install symfony/framework-bundle dependency to use CommandContext. |
||
37 | */ |
||
38 | public function initialize(array $config, ContainerInterface $container) |
||
48 | |||
49 | /** |
||
50 | * @param string $command |
||
51 | * |
||
52 | * @When /^I run (.*)$/ |
||
53 | */ |
||
54 | public function iRunCommand($command) |
||
68 | |||
69 | /** |
||
70 | * @param int $code |
||
71 | * |
||
72 | * @throws \Exception |
||
73 | * |
||
74 | * @Then /^command should be successfully executed$/ |
||
75 | * @Then /^command exit code should be (?P<code>\-\d+|\d+)$/ |
||
76 | */ |
||
77 | public function commandExitCodeShouldBe($code = 0) |
||
89 | |||
90 | /** |
||
91 | * @param PyStringNode $message |
||
92 | * |
||
93 | * @throws \Exception |
||
94 | * |
||
95 | * @Then /^command should throw an exception$/ |
||
96 | * @Then /^command should throw following exception:?$/ |
||
97 | */ |
||
98 | public function commandShouldThrowException(PyStringNode $message = null) |
||
119 | |||
120 | /** |
||
121 | * @param PyStringNode $string |
||
122 | * |
||
123 | * @throws \Exception |
||
124 | * |
||
125 | * @Then /^command output should be like:?$/ |
||
126 | */ |
||
127 | public function commandOutputShouldBeLike(PyStringNode $string) |
||
142 | |||
143 | /** |
||
144 | * @return string |
||
145 | * |
||
146 | * @throws \Exception |
||
147 | */ |
||
148 | private function getRawCommandOutput() |
||
157 | } |
||
158 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.