@@ -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 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param SpecificationTester $baseTester |
| 48 | 48 | */ |
| 49 | - public function __construct(SpecificationTester $baseTester, $variantTags, ConfigsRepository $configsRepo ) { |
|
| 49 | + public function __construct(SpecificationTester $baseTester, $variantTags, ConfigsRepository $configsRepo) { |
|
| 50 | 50 | $this->baseTester = $baseTester; |
| 51 | 51 | $this->variantTags = $variantTags; |
| 52 | 52 | $this->configsRepo = $configsRepo; |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | foreach ($feature->getScenarios() as $scenario) { |
| 80 | 80 | $configTag = $this->getScenarioConfigTag($scenario); |
| 81 | 81 | $scenarioVariants = array_intersect($scenario->getTags(), $this->variantTags); |
| 82 | - if (count($scenarioVariants) == 1){ |
|
| 82 | + if (count($scenarioVariants) == 1) { |
|
| 83 | 83 | $injectedScenario = new ScenarioNode( |
| 84 | 84 | $scenario->getTitle(), |
| 85 | 85 | $scenario->getTags(), |
| 86 | - $this->injectParametersOnSteps($scenario->getSteps(), end($scenarioVariants),$configTag), |
|
| 86 | + $this->injectParametersOnSteps($scenario->getSteps(), end($scenarioVariants), $configTag), |
|
| 87 | 87 | $scenario->getKeyword(), |
| 88 | 88 | $scenario->getLine()); |
| 89 | 89 | $scenarios[] = $injectedScenario; |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | ); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - private function getScenarioConfigTag(ScenarioNode $scenario){ |
|
| 104 | + private function getScenarioConfigTag(ScenarioNode $scenario) { |
|
| 105 | 105 | $availableTags = $this->configsRepo->getTags(); |
| 106 | - $configTags = array_intersect($scenario->getTags(),$availableTags ); |
|
| 106 | + $configTags = array_intersect($scenario->getTags(), $availableTags); |
|
| 107 | 107 | |
| 108 | 108 | if (count($configTags) > 1) { |
| 109 | - throw new \Exception ("Scenario {$scenario->getTitle()}" |
|
| 109 | + throw new \Exception("Scenario {$scenario->getTitle()}" |
|
| 110 | 110 | . " should have only ONE of the following Placeholder" |
| 111 | 111 | . " File Tags: " . implode(',', $availableTags)); |
| 112 | 112 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | private function forkScenario(ScenarioNode $scenario, $variants, $configTag) { |
| 124 | 124 | $scenarios = array(); |
| 125 | - $nonVariantTags = array_filter($scenario->getTags(), function ($val) { |
|
| 125 | + $nonVariantTags = array_filter($scenario->getTags(), function($val) { |
|
| 126 | 126 | if (!in_array($val, $this->variantTags)) |
| 127 | 127 | return TRUE; |
| 128 | 128 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @return string[] |
| 26 | 26 | * @todo read configs and also bring alternative @config:section tags |
| 27 | 27 | */ |
| 28 | - public function getTags(){ |
|
| 28 | + public function getTags() { |
|
| 29 | 29 | return array_keys($this->configs); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -35,26 +35,26 @@ discard block |
||
| 35 | 35 | * @param type $config_files |
| 36 | 36 | * @todo user %paths.base% value |
| 37 | 37 | */ |
| 38 | - private function loadConfigFiles($configs_mapping){ |
|
| 38 | + private function loadConfigFiles($configs_mapping) { |
|
| 39 | 39 | $placeholder_maps = array(); |
| 40 | - foreach ($configs_mapping as $tag => $file_path){ |
|
| 40 | + foreach ($configs_mapping as $tag => $file_path) { |
|
| 41 | 41 | $placeholder_maps[$tag]['config'] = Yaml::parse(file_get_contents($file_path)); |
| 42 | 42 | $placeholder_maps[$tag]['path'] = $file_path; |
| 43 | 43 | } |
| 44 | 44 | $this->configs = $placeholder_maps; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function getConfigSection($tag, $section){ |
|
| 47 | + public function getConfigSection($tag, $section) { |
|
| 48 | 48 | if ($this->hasTag($tag)) return $this->configs[$tag]['config'][$section]; |
| 49 | 49 | return NULL; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function getFilePath($tag){ |
|
| 52 | + public function getFilePath($tag) { |
|
| 53 | 53 | if ($this->hasTag($tag)) return $this->configs[$tag]['path']; |
| 54 | 54 | return NULL; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function hasTag($tag){ |
|
| 57 | + public function hasTag($tag) { |
|
| 58 | 58 | if (key_exists($tag, $this->configs)) return true; |
| 59 | 59 | else return false; |
| 60 | 60 | } |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Symfony\Component\Console\Command\Command as SymfonyCommand; |
| 6 | 6 | use Symfony\Component\Console\Input\InputArgument; |
| 7 | 7 | use Symfony\Component\Console\Input\InputInterface; |
| 8 | -use Symfony\Component\Console\Input\InputOption; |
|
| 9 | 8 | use Symfony\Component\Console\Output\OutputInterface; |
| 10 | 9 | use Ciandt\Behat\PlaceholdersExtension\Tester\PlaceholdersReplacer; |
| 11 | 10 | |
@@ -2,10 +2,8 @@ discard block |
||
| 2 | 2 | namespace Ciandt\Behat\PlaceholdersExtension\ServiceContainer; |
| 3 | 3 | |
| 4 | 4 | use Ciandt\Behat\PlaceholdersExtension\Config\ConfigsRepository; |
| 5 | -use Ciandt\Behat\PlaceholdersExtension\Tester\PerVariantScenarioTester; |
|
| 6 | 5 | use Ciandt\Behat\PlaceholdersExtension\Tester\PlaceholdersReplacer; |
| 7 | 6 | use Behat\Testwork\Cli\ServiceContainer\CliExtension; |
| 8 | -use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension; |
|
| 9 | 7 | use Behat\Testwork\ServiceContainer\Extension; |
| 10 | 8 | use Behat\Testwork\ServiceContainer\ExtensionManager; |
| 11 | 9 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
@@ -13,7 +11,6 @@ discard block |
||
| 13 | 11 | use Symfony\Component\DependencyInjection\Definition; |
| 14 | 12 | use Symfony\Component\DependencyInjection\Reference; |
| 15 | 13 | use Behat\Behat\Tester\ServiceContainer\TesterExtension; |
| 16 | -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; |
|
| 17 | 14 | |
| 18 | 15 | final class PlaceholdersExtension implements Extension |
| 19 | 16 | { |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | use Behat\Testwork\Environment\Environment; |
| 10 | 10 | use Behat\Testwork\Tester\Setup\SuccessfulSetup; |
| 11 | 11 | use Behat\Testwork\Tester\Setup\SuccessfulTeardown; |
| 12 | -use Behat\Behat\Tester\ServiceContainer\TesterExtension; |
|
| 13 | 12 | |
| 14 | 13 | /** |
| 15 | 14 | * Tester executing step tests in the runtime. |