Permalink
Browse files

MDL-54553 behat: check statuscode of http request

  • Loading branch information...
danpoltawski committed May 12, 2016
1 parent f38e287 commit 114c6918b6b63bfbbbdd43da9caad47e014b8285
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/behat/classes/util.php
@@ -151,17 +151,17 @@ public static function check_server_status() {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$statuscode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if (empty($result)) {
if ($statuscode !== 200 || empty($result) || (!$result = json_decode($result, true))) {
behat_error (BEHAT_EXITCODE_REQUIREMENT, $CFG->behat_wwwroot . ' is not available, ensure you specified ' .
'correct url and that the server is set up and started.' . PHP_EOL . ' More info in ' .
behat_command::DOCS_URL . '#Running_tests' . PHP_EOL);
}
// Check if cli version is same as web version.
$result = json_decode($result, true);
$clienv = self::get_environment();
if ($result != $clienv) {
$output = 'Differences detected between cli and webserver...'.PHP_EOL;

0 comments on commit 114c691

Please sign in to comment.