From 2dae755883e4f55f1cc8325c16595952dd40c376 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Fri, 1 Apr 2016 13:02:22 -0400 Subject: [PATCH] [TEST] Replace stash before finding nested variables in match --- tests/Elasticsearch/Tests/YamlRunnerTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Elasticsearch/Tests/YamlRunnerTest.php b/tests/Elasticsearch/Tests/YamlRunnerTest.php index a152f1340..47bfbbe69 100644 --- a/tests/Elasticsearch/Tests/YamlRunnerTest.php +++ b/tests/Elasticsearch/Tests/YamlRunnerTest.php @@ -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 @@ -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); @@ -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];