Skip to content

Commit 6002822

Browse files
committed
[TEST] Fix teardown in yaml runner
Also include a quick fix for some malformed upstream yaml tests
1 parent f95186e commit 6002822

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/Elasticsearch/Tests/YamlRunnerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,8 @@ private function splitDocument(SplFileInfo $file, string $path, string $filter =
950950
$skip = false;
951951
$documentParsed = null;
952952
foreach ($documents as $documentString) {
953+
// TODO few bad instances of teardown, should be fixed in upstream but this is a quick fix locally
954+
$documentString = str_replace(" teardown:", "teardown:", $documentString);
953955
try {
954956
if (!$setupSkip) {
955957
$documentParsed = $this->yaml->parse($documentString, false, false, true);
@@ -984,7 +986,7 @@ private function splitDocument(SplFileInfo $file, string $path, string $filter =
984986
if (!$skip && key($documentParsed) === 'setup') {
985987
$setup = $documentParsed;
986988
$setupSkip = $skip;
987-
} elseif (!$skip && key($documentParsed) === 'teardown') {
989+
} elseif (!$teardown && key($documentParsed) === 'teardown') {
988990
$teardown = $documentParsed;
989991
} else {
990992
$documentsParsed[] = [$documentParsed, $skip || $setupSkip, $setup, $teardown, $fileName];

0 commit comments

Comments
 (0)