public function testSummarizeCommits() { // Cyrillic "zhe". $zhe = "ж"; // Symbol "Snowman". $snowman = "☃"; // Emoji "boar". $boar = "🐗"; // Proper unicode truncation is tested elsewhere, this is just making // sure column length handling is sane. $map = array('' => 0, 'a' => 1, str_repeat('a', 81) => 82, str_repeat('a', 255) => 82, str_repeat('aa ', 30) => 80, str_repeat($zhe, 300) => 161, str_repeat($snowman, 300) => 240, str_repeat($boar, 300) => 255); foreach ($map as $input => $expect) { $actual = PhabricatorRepositoryCommitData::summarizeCommitMessage($input); $this->assertEqual($expect, strlen($actual)); } }
public function getSummary() { return PhabricatorRepositoryCommitData::summarizeCommitMessage($this->getMessage()); }