Commit e68a3da5 authored by Simon Welsh's avatar Simon Welsh

Add a test to make sure everything in HHI exists

parent 2db6f51e
Pipeline #189 passed with stages
in 2 minutes and 18 seconds
<?hh // strict
namespace PHPUnitHHI;
class ConversionTest extends HHITest {
public function testAllClassesExist(): void {
$cmd = 'hh_client --json --search-class PHPUnit';
$ret = null;
$output_arr = null;
$output = \exec($cmd, $output_arr, $ret);
$json = @\json_decode($output, true);
if (\json_last_error() != JSON_ERROR_NONE) {
$this->fail(sprintf('Invalid JSON: %s', $output));
}
foreach ($json as $rec) {
if ($rec['desc'] == 'class' || $rec['desc'] == 'abstract class') {
$this->assertTrue(
\class_exists($rec['name'], true),
\sprintf('Class "%s" does not exist', $rec['name']),
);
} else if ($rec['desc'] == 'interface') {
$this->assertTrue(
\interface_exists($rec['name'], true),
\sprintf('Interface "%s" does not exist', $rec['name']),
);
} else {
$this->fail(
\sprintf('Unknown class description: "%s"', $rec['desc']),
);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment