diff --git a/src/ServiceContainer/Driver/PantherFactory.php b/src/ServiceContainer/Driver/PantherFactory.php index ed9e4bd..e8519e0 100644 --- a/src/ServiceContainer/Driver/PantherFactory.php +++ b/src/ServiceContainer/Driver/PantherFactory.php @@ -36,6 +36,8 @@ public function configure(ArrayNodeDefinition $builder) { $configuration = new PantherConfiguration(); $builder->append($configuration->addOptionsNode()); + $builder->append($configuration->addKernelOptionsNode()); + $builder->append($configuration->addManagerOptionsNode()); } /** @@ -53,6 +55,8 @@ public function buildDriver(array $config) 'Behat\Mink\Driver\PantherDriver', array( $config['options'] ?? [], + $config['kernel_options'] ?? [], + $config['manager_options'] ?? [], ) ); } diff --git a/src/ServiceContainer/PantherConfiguration.php b/src/ServiceContainer/PantherConfiguration.php index aa1225c..86814e1 100644 --- a/src/ServiceContainer/PantherConfiguration.php +++ b/src/ServiceContainer/PantherConfiguration.php @@ -24,7 +24,11 @@ public function getConfigTreeBuilder() $root = $treeBuilder->root('panther'); } - $root->append($this->addOptionsNode()); + $root->children() + ->append($this->addOptionsNode()) + ->append($this->addKernelOptionsNode()) + ->append($this->addManagerOptionsNode()) + ->end(); return $treeBuilder; } @@ -50,4 +54,48 @@ public function addOptionsNode(): ArrayNodeDefinition return $node; } + + public function addKernelOptionsNode(): ArrayNodeDefinition + { + $treeBuilder = new TreeBuilder('kernel_options'); + + if (\method_exists($treeBuilder, 'getRootNode')) { + $root = $treeBuilder->getRootNode(); + } else { + $root = $treeBuilder->root('kernel_options'); + } + + $node = $root + ->info( + "These are the options passed as second argument to PantherTestCaseTrait::createPantherClient client constructor." + ) + ->ignoreExtraKeys() + ->scalarPrototype() + ->end() + ; + + return $node; + } + + public function addManagerOptionsNode(): ArrayNodeDefinition + { + $treeBuilder = new TreeBuilder('manager_options'); + + if (\method_exists($treeBuilder, 'getRootNode')) { + $root = $treeBuilder->getRootNode(); + } else { + $root = $treeBuilder->root('manager_options'); + } + + $node = $root + ->info( + "These are the options passed as third argument to PantherTestCaseTrait::createPantherClient client constructor." + ) + ->ignoreExtraKeys() + ->scalarPrototype() + ->end() + ; + + return $node; + } } diff --git a/tests/Unit/PantherConfigurationTest.php b/tests/Unit/PantherConfigurationTest.php index c5abd90..bfb1458 100644 --- a/tests/Unit/PantherConfigurationTest.php +++ b/tests/Unit/PantherConfigurationTest.php @@ -68,6 +68,8 @@ public function test_processed_configuration(): void 'options' => [ 'hostname' => '127.0.0.1', ], + 'kernel_options' => [], + 'manager_options' => [], ] ); }