@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorMarkupEngineTestCase
4 extends PhabricatorTestCase {
5
6 public function testRemarkupSentenceSummmaries() {
7 $this->assertSentenceSummary(
8 'The quick brown fox. Jumped over the lazy dog.',
9 'The quick brown fox.');
10
11 $this->assertSentenceSummary(
12 'Go to www.help.com for details. Good day.',
13 'Go to www.help.com for details.');
14
15 $this->assertSentenceSummary(
16 'Coxy lummox gives squid who asks for job pen.',
17 'Coxy lummox gives squid who asks for job pen.');
18
19 $this->assertSentenceSummary(
20 'DEPRECATED',
21 'DEPRECATED');
22
23 $this->assertSentenceSummary(
24 'Never use this! It is deadly poison.',
25 'Never use this!');
26
27 $this->assertSentenceSummary(
28 "a short poem\nmeow meow meow\nmeow meow meow\n\n- cat",
29 'a short poem');
30
31 $this->assertSentenceSummary(
32 'WOW!! GREAT PROJECT!',
33 'WOW!!');
34 }
35
36 private function assertSentenceSummary($corpus, $summary) {
37 $this->assertEqual(
38 $summary,
39 PhabricatorMarkupEngine::summarizeSentence($corpus),
40 pht('Summary of: %s', $corpus));
41 }
42
43}