Skip to content

Commit

Permalink
[TEST] Replace stash before finding nested variables in match
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfractal committed Apr 1, 2016
1 parent e0956a5 commit 2dae755
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/Elasticsearch/Tests/YamlRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class YamlRunnerTest extends \PHPUnit_Framework_TestCase
/** @var string */
public static $esVersion;

private static $testCounter = 0;
public static $testCounter = 0;

/**
* @return mixed
Expand Down Expand Up @@ -458,7 +458,8 @@ private function executeTestCase($test, $testFile, $future)
} elseif (key($settings) === '$body') {
$actual = $response;
} else {
$actual = $this->getNestedVar($response, key($settings));
$path = YamlRunnerTest::replaceWithStash(key($settings), $stash);
$actual = $this->getNestedVar($response, $path);
}

$expected = YamlRunnerTest::replaceWithStash($expected, $stash);
Expand Down Expand Up @@ -689,6 +690,8 @@ private function getNestedVar(&$context, $name)
$piece = str_replace('\.', '.', $piece);
if (!is_array($context) || !array_key_exists($piece, $context)) {
// error occurred
echo "Could not find nested property [$piece] in context: ".print_r($context, true);
echo "\nReturning null...";
return null;
}
$context = &$context[$piece];
Expand Down

0 comments on commit 2dae755

Please sign in to comment.