Skip to content

Commit

Permalink
make kernel options and manager options configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
phcorp committed Mar 9, 2021
1 parent b540bfd commit ddde041
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/ServiceContainer/Driver/PantherFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public function configure(ArrayNodeDefinition $builder)
{
$configuration = new PantherConfiguration();
$builder->append($configuration->addOptionsNode());
$builder->append($configuration->addKernelOptionsNode());
$builder->append($configuration->addManagerOptionsNode());
}

/**
Expand All @@ -53,6 +55,8 @@ public function buildDriver(array $config)
'Behat\Mink\Driver\PantherDriver',
array(
$config['options'] ?? [],
$config['kernel_options'] ?? [],
$config['manager_options'] ?? [],
)
);
}
Expand Down
50 changes: 49 additions & 1 deletion src/ServiceContainer/PantherConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
}

0 comments on commit ddde041

Please sign in to comment.