Skip to content

Commit 7ff9b20

Browse files
committed
[TEST] Regex to detect "stashed" values is not useful, throws false-positives
1 parent a9ee47d commit 7ff9b20

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/Elasticsearch/Tests/YamlRunnerTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,10 @@ private function replaceWithContext($data, $context)
651651
return $data;
652652
}
653653

654-
if (is_string($data) && preg_match('/\$.+?$/', $data)) {
655-
if (!array_key_exists($data, $context)) {
656-
static::fail(sprintf('Cannot find variable %s in context', $data));
654+
if (is_string($data)) {
655+
if (array_key_exists($data, $context)) {
656+
return $context[$data];
657657
}
658-
659-
return $context[$data];
660658
}
661659

662660
if (!is_array($data) && !$data instanceof \stdClass) {

0 commit comments

Comments
 (0)