@@ -32,7 +32,6 @@ |
||
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * |
| 35 | - * @param type $config_files |
|
| 36 | 35 | * @todo user %paths.base% value |
| 37 | 36 | */ |
| 38 | 37 | private function loadConfigFiles($configs_mapping){ |
@@ -45,17 +45,24 @@ |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function getConfigSection($tag, $section){ |
| 48 | - if ($this->hasTag($tag)) return $this->configs[$tag]['config'][$section]; |
|
| 48 | + if ($this->hasTag($tag)) { |
|
| 49 | + return $this->configs[$tag]['config'][$section]; |
|
| 50 | + } |
|
| 49 | 51 | return NULL; |
| 50 | 52 | } |
| 51 | 53 | |
| 52 | 54 | public function getFilePath($tag){ |
| 53 | - if ($this->hasTag($tag)) return $this->configs[$tag]['path']; |
|
| 55 | + if ($this->hasTag($tag)) { |
|
| 56 | + return $this->configs[$tag]['path']; |
|
| 57 | + } |
|
| 54 | 58 | return NULL; |
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function hasTag($tag){ |
| 58 | - if (key_exists($tag, $this->configs)) return true; |
|
| 59 | - else return false; |
|
| 62 | + if (key_exists($tag, $this->configs)) { |
|
| 63 | + return true; |
|
| 64 | + } else { |
|
| 65 | + return false; |
|
| 66 | + } |
|
| 60 | 67 | } |
| 61 | 68 | } |
@@ -104,6 +104,10 @@ |
||
| 104 | 104 | $step->getKeyword(), $text, $arguments, $step->getLine(), $step->getKeywordType()); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | + /** |
|
| 108 | + * @param string $string |
|
| 109 | + * @param string $env |
|
| 110 | + */ |
|
| 107 | 111 | private function replacePlaceholders($string, $var, $env) { |
| 108 | 112 | preg_match_all('/\${(?P<key>[^}]+)}/i', $string, $placeholders, PREG_SET_ORDER); |
| 109 | 113 | foreach ($placeholders as $placeholder) { |
@@ -120,6 +120,9 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | + /** |
|
| 124 | + * @param string[] $variants |
|
| 125 | + */ |
|
| 123 | 126 | private function forkScenario(ScenarioNode $scenario, $variants, $configTag) { |
| 124 | 127 | $scenarios = array(); |
| 125 | 128 | $nonVariantTags = array_filter($scenario->getTags(), function ($val) { |
@@ -141,6 +144,9 @@ discard block |
||
| 141 | 144 | return $scenarios; |
| 142 | 145 | } |
| 143 | 146 | |
| 147 | + /** |
|
| 148 | + * @param StepNode[] $steps |
|
| 149 | + */ |
|
| 144 | 150 | private function injectParametersOnSteps($steps, $variant, $configTag) { |
| 145 | 151 | $injectedSteps = array(); |
| 146 | 152 | foreach ($steps as $step) { |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | $variantTags = $this->variantTags; |
| 69 | 69 | if ($variantTags) { |
| 70 | 70 | return $tester->test($env, $this->reconstructFeature($feature), $skip); |
| 71 | - } |
|
| 72 | - else { |
|
| 71 | + } else { |
|
| 73 | 72 | return $tester->test($env, $feature, $skip); |
| 74 | 73 | } |
| 75 | 74 | } |
@@ -87,11 +86,9 @@ discard block |
||
| 87 | 86 | $scenario->getKeyword(), |
| 88 | 87 | $scenario->getLine()); |
| 89 | 88 | $scenarios[] = $injectedScenario; |
| 90 | - } |
|
| 91 | - elseif (count($scenarioVariants) > 1) { |
|
| 89 | + } elseif (count($scenarioVariants) > 1) { |
|
| 92 | 90 | $scenarios = array_merge($scenarios, $this->forkScenario($scenario, $scenarioVariants, $configTag)); |
| 93 | - } |
|
| 94 | - else { |
|
| 91 | + } else { |
|
| 95 | 92 | $scenarios[] = $scenario; |
| 96 | 93 | } |
| 97 | 94 | } |
@@ -123,8 +120,9 @@ discard block |
||
| 123 | 120 | private function forkScenario(ScenarioNode $scenario, $variants, $configTag) { |
| 124 | 121 | $scenarios = array(); |
| 125 | 122 | $nonVariantTags = array_filter($scenario->getTags(), function ($val) { |
| 126 | - if (!in_array($val, $this->variantTags)) |
|
| 127 | - return TRUE; |
|
| 123 | + if (!in_array($val, $this->variantTags)) { |
|
| 124 | + return TRUE; |
|
| 125 | + } |
|
| 128 | 126 | } |
| 129 | 127 | ); |
| 130 | 128 | foreach ($variants as $variant) { |
@@ -146,7 +144,9 @@ discard block |
||
| 146 | 144 | foreach ($steps as $step) { |
| 147 | 145 | $newStep = clone $step; |
| 148 | 146 | $newStep->variant = $variant; |
| 149 | - if ($configTag) $newStep->configTag = $configTag; |
|
| 147 | + if ($configTag) { |
|
| 148 | + $newStep->configTag = $configTag; |
|
| 149 | + } |
|
| 150 | 150 | $injectedSteps[] = $newStep; |
| 151 | 151 | } |
| 152 | 152 | return $injectedSteps; |