You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.3 KiB

<?php
namespace FastRoute;
class HackTypecheckerTest extends \PhpUnit_Framework_TestCase {
const SERVER_ALREADY_RUNNING_CODE = 77;
public function testTypechecks($recurse = true) {
if (!defined('HHVM_VERSION')) {
$this->markTestSkipped("HHVM only");
}
if (!version_compare(HHVM_VERSION, '3.9.0', '>=')) {
$this->markTestSkipped('classname<T> requires HHVM 3.9+');
}
// The typechecker recurses the whole tree, so it makes sure
// that everything in fixtures/ is valid when this runs.
$output = array();
$exit_code = null;
exec(
'hh_server --check '.escapeshellarg(__DIR__.'/../../').' 2>&1',
$output,
$exit_code
);
if ($exit_code === self::SERVER_ALREADY_RUNNING_CODE) {
$this->assertTrue(
$recurse,
"Typechecker still running after running hh_client stop"
);
// Server already running - 3.10 => 3.11 regression:
// https://github.com/facebook/hhvm/issues/6646
exec('hh_client stop 2>/dev/null');
$this->testTypechecks(/* recurse = */ false);
return;
}
$this->assertSame(0, $exit_code, implode("\n", $output));
}
}