@@ -3,21 +3,13 @@ |
||
3 | 3 | |
4 | 4 | namespace Ciandt\Behat\PlaceholdersExtension\Tester; |
5 | 5 | |
6 | -use Behat\Behat\Tester\OutlineTester; |
|
7 | -use Behat\Behat\Tester\ScenarioTester; |
|
8 | -use Behat\Gherkin\Node\OutlineNode; |
|
9 | 6 | use Behat\Testwork\Environment\Environment; |
10 | -use Behat\Testwork\Environment\EnvironmentManager; |
|
11 | -use Behat\Testwork\Tester\Result\IntegerTestResult; |
|
12 | 7 | use Behat\Testwork\Tester\Result\TestResult; |
13 | -use Behat\Testwork\Tester\Result\TestResults; |
|
14 | -use Behat\Testwork\Tester\Result\TestWithSetupResult; |
|
15 | 8 | use Behat\Testwork\Tester\Setup\SuccessfulSetup; |
16 | 9 | use Behat\Testwork\Tester\Setup\SuccessfulTeardown; |
17 | 10 | use Behat\Testwork\Tester\SpecificationTester; |
18 | 11 | use Behat\Gherkin\Node\FeatureNode; |
19 | 12 | use Behat\Gherkin\Node\ScenarioNode; |
20 | -use Behat\Gherkin\Node\StepNode; |
|
21 | 13 | use Ciandt\Behat\PlaceholdersExtension\Config\ConfigsRepository; |
22 | 14 | |
23 | 15 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $scenarios = array(); |
76 | 76 | |
77 | 77 | foreach ($feature->getScenarios() as $scenario) { |
78 | - $scenarios = array_merge($scenarios,$this->splitScenarioPerVariants($scenario,$feature)); |
|
78 | + $scenarios = array_merge($scenarios, $this->splitScenarioPerVariants($scenario, $feature)); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return new FeatureNode( |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
94 | - private function splitScenarioPerVariants(ScenarioNode $scenario, FeatureNode $feature){ |
|
94 | + private function splitScenarioPerVariants(ScenarioNode $scenario, FeatureNode $feature) { |
|
95 | 95 | $scenarioTags = $scenario->getTags(); |
96 | 96 | $featureTags = $feature->getTags(); |
97 | - $tags = array_merge($scenarioTags,$featureTags); |
|
97 | + $tags = array_merge($scenarioTags, $featureTags); |
|
98 | 98 | |
99 | - $variants = PlaceholderUtils::filterVariantTags($tags,false); |
|
99 | + $variants = PlaceholderUtils::filterVariantTags($tags, false); |
|
100 | 100 | |
101 | 101 | if (count($variants) <= 1) { |
102 | 102 | return array($scenario); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | private function forkScenario(ScenarioNode $scenario, $variants) |
110 | 110 | { |
111 | 111 | $scenarios = array(); |
112 | - $nonVariantTags = PlaceholderUtils::filterVariantTags($scenario->getTags(),true); |
|
112 | + $nonVariantTags = PlaceholderUtils::filterVariantTags($scenario->getTags(), true); |
|
113 | 113 | foreach ($variants as $variant) { |
114 | 114 | $tags = array_merge($nonVariantTags, array($variant)); |
115 | 115 | $scenarios[] = new ScenarioNode( |
@@ -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){ |
@@ -2,7 +2,6 @@ |
||
2 | 2 | namespace Ciandt\Behat\PlaceholdersExtension\Config; |
3 | 3 | |
4 | 4 | use Symfony\Component\Yaml\Yaml; |
5 | -use Ciandt\Behat\PlaceholdersExtension\Utils\PlaceholderUtils; |
|
6 | 5 | use Ciandt\Behat\PlaceholdersExtension\PlaceholderContainer\PlaceholderContainer; |
7 | 6 | use Ciandt\Behat\PlaceholdersExtension\Exception\MissingSectionException; |
8 | 7 | use Ciandt\Behat\PlaceholdersExtension\Exception\UndefinedPlaceholderException; |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | public function getFilePath($key) |
64 | 64 | { |
65 | - if (key_exists($key, $this->configs)) { |
|
65 | + if (key_exists($key, $this->configs)) { |
|
66 | 66 | return $this->configs[$key]['path']; |
67 | 67 | } |
68 | 68 | return null; |
@@ -107,11 +107,11 @@ |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - private function getSectionPlaceholders(PlaceholderContainer $container){ |
|
110 | + private function getSectionPlaceholders(PlaceholderContainer $container) { |
|
111 | 111 | $configKey = $container->getConfigKey(); |
112 | 112 | $config = $this->getConfig($configKey); |
113 | 113 | $sectionKey = $container->getSectionKey(); |
114 | - if (!key_exists($sectionKey, $config)){ |
|
114 | + if (!key_exists($sectionKey, $config)) { |
|
115 | 115 | throw new MissingSectionException( |
116 | 116 | $configKey, |
117 | 117 | $this->getFilePath($configKey), |
@@ -2,11 +2,8 @@ discard block |
||
2 | 2 | namespace Ciandt\Behat\PlaceholdersExtension\ServiceContainer; |
3 | 3 | |
4 | 4 | use Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository; |
5 | -use Ciandt\Behat\PlaceholdersExtension\Tester\PerVariantScenarioTester; |
|
6 | -use Ciandt\Behat\PlaceholdersExtension\Tester\PlaceholderReplacingStepTester; |
|
7 | 5 | use Ciandt\Behat\PlaceholdersExtension\Utils\PlaceholderUtils; |
8 | 6 | use Behat\Testwork\Cli\ServiceContainer\CliExtension; |
9 | -use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension; |
|
10 | 7 | use Behat\Testwork\ServiceContainer\Extension; |
11 | 8 | use Behat\Testwork\ServiceContainer\ExtensionManager; |
12 | 9 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
@@ -14,7 +11,6 @@ discard block |
||
14 | 11 | use Symfony\Component\DependencyInjection\Definition; |
15 | 12 | use Symfony\Component\DependencyInjection\Reference; |
16 | 13 | use Behat\Behat\Tester\ServiceContainer\TesterExtension; |
17 | -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; |
|
18 | 14 | use Behat\Behat\Transformation\ServiceContainer\TransformationExtension; |
19 | 15 | |
20 | 16 | final class PlaceholdersExtension implements Extension |
@@ -101,7 +101,7 @@ |
||
101 | 101 | $container->setDefinition(self::PLACEHOLDERS_CONTROLLER_ID, $definition); |
102 | 102 | } |
103 | 103 | |
104 | - protected function initializePlaceholderUtils($variantTags,$configTags){ |
|
104 | + protected function initializePlaceholderUtils($variantTags, $configTags) { |
|
105 | 105 | PlaceholderUtils::setVariantTags($variantTags); |
106 | 106 | PlaceholderUtils::setConfigKeys(array_keys($configTags)); |
107 | 107 | } |
@@ -25,6 +25,9 @@ |
||
25 | 25 | return self::USER_DEFINED_PLACEHOLDER_REGEX; |
26 | 26 | } |
27 | 27 | |
28 | + /** |
|
29 | + * @param string $string |
|
30 | + */ |
|
28 | 31 | private static function replaceStringPlaceholders($string, PlaceholdersRepository $repository, PlaceholderContainerStepNode $container) { |
29 | 32 | preg_match_all(self::USER_DEFINED_PLACEHOLDER_REGEX, $string, $matches, PREG_SET_ORDER); |
30 | 33 | foreach ($matches as $match) { |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Ciandt\Behat\PlaceholdersExtension\Transformer; |
4 | 4 | |
5 | 5 | use Behat\Behat\Transformation\Transformer\ArgumentTransformer; |
6 | -use Ciandt\Behat\PlaceholdersExtension\PlaceholderContainer\PlaceholderContainerStepNode; |
|
7 | 6 | use Ciandt\Behat\PlaceholdersExtension\Transformation\RuntimePlaceholdersTransformation; |
8 | 7 | use Behat\Behat\Definition\Call\DefinitionCall; |
9 | 8 | use Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository; |
@@ -10,7 +10,6 @@ |
||
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Transforms a single argument value. |
13 | - |
|
14 | 13 | */ |
15 | 14 | class PlaceholdersTransformer implements ArgumentTransformer |
16 | 15 | { |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function transformArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) { |
30 | 30 | $transformedArgument = $argumentValue; |
31 | - if (RuntimePlaceholdersTransformation::supportsDefinitionAndArgument($definitionCall, $argumentValue)){ |
|
31 | + if (RuntimePlaceholdersTransformation::supportsDefinitionAndArgument($definitionCall, $argumentValue)) { |
|
32 | 32 | $transformedArgument = RuntimePlaceholdersTransformation::transformArgument( |
33 | 33 | $transformedArgument, |
34 | 34 | $this->placeholdersRepository, |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @author bwowk |
11 | 11 | */ |
12 | -class MissingSectionException extends RuntimeException{ |
|
12 | +class MissingSectionException extends RuntimeException { |
|
13 | 13 | |
14 | 14 | |
15 | 15 | public function __construct($configKey, $configPath, $section) { |
@@ -8,6 +8,6 @@ |
||
8 | 8 | * |
9 | 9 | * @author bwowk |
10 | 10 | */ |
11 | -class UndefinedPlaceholderException extends RuntimeException{ |
|
11 | +class UndefinedPlaceholderException extends RuntimeException { |
|
12 | 12 | //put your code here |
13 | 13 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @author bwowk |
11 | 11 | */ |
12 | -class RedundantConfigTagException extends RuntimeException{ |
|
12 | +class RedundantConfigTagException extends RuntimeException { |
|
13 | 13 | public function __construct($tags) { |
14 | 14 | $message = "Multiple config tags found. Should have only one: " . implode(', ', $tags); |
15 | 15 | parent::__construct($message); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @author bwowk |
12 | 12 | */ |
13 | -class PlaceholderContainerStepNode extends StepNode implements PlaceholderContainer{ |
|
13 | +class PlaceholderContainerStepNode extends StepNode implements PlaceholderContainer { |
|
14 | 14 | |
15 | 15 | private $stepNode; |
16 | 16 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | private $sectionKey; |
22 | 22 | |
23 | - function __construct($stepNode,$configKey, $sectionKey, $variant) { |
|
23 | + function __construct($stepNode, $configKey, $sectionKey, $variant) { |
|
24 | 24 | $this->stepNode = $stepNode; |
25 | 25 | $this->configKey = $configKey; |
26 | 26 | $this->sectionKey = $sectionKey; |