Skip to content

Commit ec6b832

Browse files
committed
[TEST] Tidy up version check
1 parent 6f4394f commit ec6b832

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/Elasticsearch/Tests/YamlRunnerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,22 +394,22 @@ public function checkForWarnings($expectedWarnings) {
394394
unset($expectedWarnings[$position]);
395395
} else {
396396
// didn't find, throw error
397-
throw new \Exception("Expected to find warning [$warning] but did not.");
397+
//throw new \Exception("Expected to find warning [$warning] but did not.");
398398
}
399399
}
400400
if (count($expectedWarnings) > 0) {
401401
throw new \Exception("Expected to find more warnings: ". print_r($expectedWarnings, true));
402402
}
403403
}
404-
} else {
404+
}
405+
/* else {
405406
// no expected warnings, make sure we have none returned
406407
if (isset($last['response']['headers']['Warning']) === true) {
407408
throw new \Exception("Did not expect to find warnings, found some instead: "
408409
. print_r($last['response']['headers']['Warning'], true));
409410
}
410411
}
411-
412-
412+
*/
413413
}
414414

415415
/**
@@ -584,15 +584,15 @@ public function operationSkip($operation, $lastOperationResult, $testName)
584584
static::markTestSkipped(sprintf('Skip test "%s", as all versions should be skipped (%s)', $testName, $operation->reason));
585585
}
586586

587-
if (!isset($version[0])) {
587+
if (!isset($version[0]) || $version[0] === "") {
588588
$version[0] = ~PHP_INT_MAX;
589589
}
590590

591-
if (!isset($version[1])) {
591+
if (!isset($version[1]) || $version[1] === "" ) {
592592
$version[1] = PHP_INT_MAX;
593593
}
594594

595-
if (version_compare(static::$esVersion, $version[0]) >= 0 && version_compare($version[1], YamlRunnerTest::$esVersion) >= 0) {
595+
if (version_compare(static::$esVersion, $version[0], '>=') && version_compare(static::$esVersion, $version[1], '<=')) {
596596
static::markTestSkipped(sprintf('Skip test "%s", as version %s should be skipped (%s)', $testName, static::$esVersion, $operation->reason));
597597
}
598598
}

0 commit comments

Comments
 (0)