Skip to content

Commit

Permalink
The test identifier is now the key of the array element.
Browse files Browse the repository at this point in the history
  • Loading branch information
waltertamboer committed Apr 23, 2016
1 parent 8a589ee commit 9b11601
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Service/EngineFactory.php
Expand Up @@ -47,17 +47,13 @@ private function loadService(ServiceLocatorInterface $serviceLocator, $serviceNa

private function loadTests(EngineInterface $engine, ServiceLocatorInterface $serviceLocator, $config)
{
foreach ($config['tests'] as $key => $testConfig) {
$this->loadTest($serviceLocator, $engine, $testConfig);
foreach ($config['tests'] as $identifier => $testConfig) {
$this->loadTest($serviceLocator, $engine, $identifier, $testConfig);
}
}

private function loadTest(ServiceLocatorInterface $serviceLocator, EngineInterface $engine, array $config)
private function loadTest(ServiceLocatorInterface $serviceLocator, EngineInterface $engine, $identifier, array $config)
{
if (!array_key_exists('identifier', $config)) {
throw new RuntimeException('Missing the "identifier" for the test.');
}

$filter = null;
if (array_key_exists('filter', $config)) {
$filter = $serviceLocator->get($config['filter']);
Expand All @@ -71,7 +67,7 @@ private function loadTest(ServiceLocatorInterface $serviceLocator, EngineInterfa
$variants = $this->loadTestVariants($serviceLocator, $config);
$options = array_key_exists('options', $config) ? $config['options'] : [];

$test = new Test($config['identifier'], $variants);
$test = new Test($identifier, $variants);

$engine->addTest($test, $options, $filter, $variantChooser);
}
Expand Down

0 comments on commit 9b11601

Please sign in to comment.