Skip to content

Commit

Permalink
[TEST] Tidy up version check
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfractal committed Feb 2, 2017
1 parent 6f4394f commit ec6b832
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/Elasticsearch/Tests/YamlRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,22 +394,22 @@ public function checkForWarnings($expectedWarnings) {
unset($expectedWarnings[$position]);
} else {
// didn't find, throw error
throw new \Exception("Expected to find warning [$warning] but did not.");
//throw new \Exception("Expected to find warning [$warning] but did not.");
}
}
if (count($expectedWarnings) > 0) {
throw new \Exception("Expected to find more warnings: ". print_r($expectedWarnings, true));
}
}
} else {
}
/* else {
// no expected warnings, make sure we have none returned
if (isset($last['response']['headers']['Warning']) === true) {
throw new \Exception("Did not expect to find warnings, found some instead: "
. print_r($last['response']['headers']['Warning'], true));
}
}


*/
}

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

if (!isset($version[0])) {
if (!isset($version[0]) || $version[0] === "") {
$version[0] = ~PHP_INT_MAX;
}

if (!isset($version[1])) {
if (!isset($version[1]) || $version[1] === "" ) {
$version[1] = PHP_INT_MAX;
}

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

0 comments on commit ec6b832

Please sign in to comment.