Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60844792
PhutilPHPFragmentLexerHighlighterTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, May 2, 22:11
Size
779 B
Mime Type
text/x-php
Expires
Sat, May 4, 22:11 (2 d)
Engine
blob
Format
Raw Data
Handle
17427899
Attached To
rPHU libphutil
PhutilPHPFragmentLexerHighlighterTestCase.php
View Options
<?php
/**
* @group testcase
*/
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
),
$highlighter
->
getHighlightFuture
(
$source
)->
resolve
(),
$f
);
}
}
}
}
Event Timeline
Log In to Comment