@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhutilJSONFragmentLexerHighlighterTestCase extends PhutilTestCase {
4
5 public function testLexer() {
6 $highlighter = id(new PhutilLexerSyntaxHighlighter())
7 ->setConfig('language', 'json')
8 ->setConfig('lexer', new PhutilJSONFragmentLexer());
9
10 $path = dirname(__FILE__).'/data/jsonfragment/';
11 foreach (Filesystem::listDirectory($path, $include_hidden = false) as $f) {
12 if (preg_match('/.test$/', $f)) {
13 $expect = preg_replace('/.test$/', '.expect', $f);
14 $source = Filesystem::readFile($path.'/'.$f);
15
16 $this->assertEqual(
17 Filesystem::readFile($path.'/'.$expect),
18 (string)$highlighter->getHighlightFuture($source)->resolve(),
19 $f);
20 }
21 }
22 }
23
24}