Differential D20977 Diff 49988 src/infrastructure/markup/syntax/highlighter/__tests__/PhutilPHPFragmentLexerHighlighterTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/markup/syntax/highlighter/__tests__/PhutilPHPFragmentLexerHighlighterTestCase.php
- This file was added.
| <?php | |||||
| final class PhutilPHPFragmentLexerHighlighterTestCase extends PhutilTestCase { | |||||
| public function testLexer() { | |||||
| $highlighter = new PhutilLexerSyntaxHighlighter(); | |||||
| $highlighter->setConfig('language', 'php'); | |||||
| $highlighter->setConfig('lexer', new PhutilPHPFragmentLexer()); | |||||
| $path = dirname(__FILE__).'/phpfragment/'; | |||||
| foreach (Filesystem::listDirectory($path, $include_hidden = false) as $f) { | |||||
| if (preg_match('/.test$/', $f)) { | |||||
| $expect = preg_replace('/.test$/', '.expect', $f); | |||||
| $source = Filesystem::readFile($path.'/'.$f); | |||||
| $this->assertEqual( | |||||
| Filesystem::readFile($path.'/'.$expect), | |||||
| (string)$highlighter->getHighlightFuture($source)->resolve(), | |||||
| $f); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||