Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / herald / storage / __tests__ / HeraldTranscriptTestCase.php
blob1dcba15d0188380757dd049e3224e4aec8846d54
1 <?php
3 final class HeraldTranscriptTestCase extends PhabricatorTestCase {
5 public function testTranscriptTruncation() {
6 $long_string = str_repeat('x', 1024 * 1024);
7 $short_string = str_repeat('x', 4096)."\n<...>";
9 $long_array = array(
10 'a' => $long_string,
11 'b' => $long_string,
14 $mixed_array = array(
15 'a' => 'abc',
16 'b' => 'def',
17 'c' => $long_string,
20 $fields = array(
21 'ls' => $long_string,
22 'la' => $long_array,
23 'ma' => $mixed_array,
26 $truncated_fields = id(new HeraldObjectTranscript())
27 ->setFields($fields)
28 ->getFields();
30 $this->assertEqual($short_string, $truncated_fields['ls']);
32 $this->assertEqual(
33 array('a', '<...>'),
34 array_keys($truncated_fields['la']));
35 $this->assertEqual(
36 $short_string.'!<...>',
37 implode('!', $truncated_fields['la']));
39 $this->assertEqual(
40 array('a', 'b', 'c'),
41 array_keys($truncated_fields['ma']));
42 $this->assertEqual(
43 'abc!def!'.substr($short_string, 6),
44 implode('!', $truncated_fields['ma']));