Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122168730
HeraldTranscriptTestCase.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
Wed, Jul 16, 07:42
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jul 18, 07:42 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27407681
Attached To
rPH Phabricator
HeraldTranscriptTestCase.php
View Options
<?php
final
class
HeraldTranscriptTestCase
extends
PhabricatorTestCase
{
public
function
testTranscriptTruncation
()
{
$long_string
=
str_repeat
(
'x'
,
1024
*
1024
);
$short_string
=
str_repeat
(
'x'
,
4096
).
"
\n
<...>"
;
$long_array
=
array
(
'a'
=>
$long_string
,
'b'
=>
$long_string
,
);
$mixed_array
=
array
(
'a'
=>
'abc'
,
'b'
=>
'def'
,
'c'
=>
$long_string
,
);
$fields
=
array
(
'ls'
=>
$long_string
,
'la'
=>
$long_array
,
'ma'
=>
$mixed_array
,
);
$truncated_fields
=
id
(
new
HeraldObjectTranscript
())
->
setFields
(
$fields
)
->
getFields
();
$this
->
assertEqual
(
$short_string
,
$truncated_fields
[
'ls'
]);
$this
->
assertEqual
(
array
(
'a'
,
'<...>'
),
array_keys
(
$truncated_fields
[
'la'
]));
$this
->
assertEqual
(
$short_string
.
'!<...>'
,
implode
(
'!'
,
$truncated_fields
[
'la'
]));
$this
->
assertEqual
(
array
(
'a'
,
'b'
,
'c'
),
array_keys
(
$truncated_fields
[
'ma'
]));
$this
->
assertEqual
(
'abc!def!'
.
substr
(
$short_string
,
6
),
implode
(
'!'
,
$truncated_fields
[
'ma'
]));
}
}
Event Timeline
Log In to Comment