create(ParserFactory::PREFER_PHP7); $config = Config::getInstance(); $config->throw_exception = false; $config->cache_directory = null; $config->stop_on_first_error = false; } public function setUp() { FileChecker::clearCache(); } public function testJsonOutput() { $file_contents = 'registerFile( 'somefile.php', $file_contents ); $file_checker = new FileChecker('somefile.php'); $file_checker->check(); $issue_data = IssueBuffer::getIssueData()[0]; $this->assertSame('somefile.php', $issue_data['file_path']); $this->assertSame('error', $issue_data['type']); $this->assertSame("The given return type 'string' for foo is incorrect, got 'int'", $issue_data['message']); $this->assertSame(2, $issue_data['line_number']); $this->assertSame( 'string', substr($file_contents, $issue_data['from'], $issue_data['to'] - $issue_data['from']) ); } }