Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F561922
PHUIInvisibleCharacterTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PHUIInvisibleCharacterTestCase.php
View Options
<?php
final
class
PHUIInvisibleCharacterTestCase
extends
PhabricatorTestCase
{
public
function
testEmptyString
()
{
$view
=
new
PHUIInvisibleCharacterView
(
''
);
$res
=
$view
->
render
();
$this
->
assertEqual
(
$res
,
array
());
}
public
function
testEmptyPlainText
()
{
$view
=
id
(
new
PHUIInvisibleCharacterView
(
''
))
->
setPlainText
(
true
);
$res
=
$view
->
render
();
$this
->
assertEqual
(
$res
,
''
);
}
public
function
testWithNamedChars
()
{
$test_input
=
"
\x
00
\n\t
"
;
$view
=
id
(
new
PHUIInvisibleCharacterView
(
$test_input
))
->
setPlainText
(
true
);
$res
=
$view
->
render
();
$this
->
assertEqual
(
$res
,
'<NULL><NEWLINE><TAB><SPACE>'
);
}
public
function
testWithHexChars
()
{
$test_input
=
"abc
\x
01"
;
$view
=
id
(
new
PHUIInvisibleCharacterView
(
$test_input
))
->
setPlainText
(
true
);
$res
=
$view
->
render
();
$this
->
assertEqual
(
$res
,
'abc<0x01>'
);
}
public
function
testWithNamedAsHex
()
{
$test_input
=
"
\x
00
\x
0a
\x
09
\x
20"
;
$view
=
id
(
new
PHUIInvisibleCharacterView
(
$test_input
))
->
setPlainText
(
true
);
$res
=
$view
->
render
();
$this
->
assertEqual
(
$res
,
'<NULL><NEWLINE><TAB><SPACE>'
);
}
public
function
testHtmlDecoration
()
{
$test_input
=
"a
\x
00
\n\t
"
;
$view
=
new
PHUIInvisibleCharacterView
(
$test_input
);
$res
=
$view
->
render
();
$this
->
assertFalse
(
$res
[
0
]
instanceof
PhutilSafeHTML
);
$this
->
assertTrue
(
$res
[
1
]
instanceof
PhutilSafeHTML
);
$this
->
assertTrue
(
$res
[
2
]
instanceof
PhutilSafeHTML
);
$this
->
assertTrue
(
$res
[
3
]
instanceof
PhutilSafeHTML
);
$this
->
assertTrue
(
$res
[
4
]
instanceof
PhutilSafeHTML
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 12:40 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
108499
Default Alt Text
PHUIInvisibleCharacterTestCase.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment