Skip to content

Commit

Permalink
@ASSERTCODE renamed to @httpcode (BC break!) and is checked on in CGI…
Browse files Browse the repository at this point in the history
… mode
  • Loading branch information
dg committed Jul 16, 2013
1 parent 75a2fe8 commit 00496a6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Tester/Runner/Job.php
Expand Up @@ -156,10 +156,10 @@ public function collect()
}

// HTTP code check
if (isset($this->options['assertcode'])) {
if (isset($this->options['httpcode']) && $this->php->isCgi()) {
$code = isset($this->headers['Status']) ? (int) $this->headers['Status'] : 200;
if ($code !== (int) $this->options['assertcode']) {
throw new JobException('Expected HTTP code ' . $this->options['assertcode'] . ' is not same as actual code ' . $code);
if ($code !== (int) $this->options['httpcode']) {
throw new JobException("Exited with HTTP code $code (expected {$this->options['httpcode']})");
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/Http.code.200.phpt
@@ -0,0 +1,7 @@
<?php

/**
* @httpCode 200
*/

require __DIR__ . '/bootstrap.php';
10 changes: 10 additions & 0 deletions tests/Http.code.500.phpt
@@ -0,0 +1,10 @@
<?php

/**
* @httpCode 500
*/

require __DIR__ . '/bootstrap.php';


header('HTTP', TRUE, 500);

0 comments on commit 00496a6

Please sign in to comment.