3 final class PhabricatorFerretEngineTestCase
4 extends PhabricatorTestCase
{
6 public function testTermsCorpus() {
8 'Hear ye, hear ye!' => ' Hear ye hear ye ',
9 "Thou whom'st've art worthy." => " Thou whom'st've art worthy ",
10 'Guaranteed to contain "food".' => ' Guaranteed to contain food ',
11 'http://example.org/path/to/file.jpg' =>
12 ' http example org path to file jpg ',
15 $engine = new ManiphestTaskFerretEngine();
17 foreach ($map as $input => $expect) {
18 $actual = $engine->newTermsCorpus($input);
23 pht('Terms corpus for: %s', $input));
27 public function testTermNgramExtraction() {
28 $snowman = "\xE2\x98\x83";
32 'ab' => array(' ab', 'ab '),
33 'abcdef' => array(' ab', 'abc', 'bcd', 'cde', 'def', 'ef '),
34 "{$snowman}" => array(" {$snowman} "),
35 "x{$snowman}y" => array(
40 "{$snowman}{$snowman}" => array(
41 " {$snowman}{$snowman}",
42 "{$snowman}{$snowman} ",
46 $ngram_engine = new PhabricatorSearchNgramEngine();
48 foreach ($map as $input => $expect) {
49 $actual = $ngram_engine->getTermNgramsFromString($input);
53 pht('Term ngrams for: %s.', $input));