|
@@ 20-30 (lines=11) @@
|
| 17 |
|
$this->assertEquals('No', ElasticaUtil::showBooleanHumanReadable(false)); |
| 18 |
|
} |
| 19 |
|
|
| 20 |
|
public function testPairOfConsecutiveIncorrectWords() { |
| 21 |
|
$sa = $this->getSuggestionArray('New Zealind raalway', |
| 22 |
|
'new zealand railway', |
| 23 |
|
'new <strong class="hl">zealand railway</strong>'); |
| 24 |
|
|
| 25 |
|
$pair = ElasticaUtil::getPhraseSuggestion($sa); |
| 26 |
|
$expected = array( |
| 27 |
|
'suggestedQuery' => 'New Zealand railway', |
| 28 |
|
'suggestedQueryHighlighted' => 'New <strong class="hl">Zealand railway</strong>' |
| 29 |
|
); |
| 30 |
|
$this->assertEquals($expected, $pair); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
|
|
@@ 34-44 (lines=11) @@
|
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
public function testBooleanQuery() { |
| 35 |
|
$sa = $this->getSuggestionArray('New Zealind AND sheep', |
| 36 |
|
'new zealand and sheep', |
| 37 |
|
'new <strong class="hl">zealand</strong> and sheep'); |
| 38 |
|
$pair = ElasticaUtil::getPhraseSuggestion($sa); |
| 39 |
|
$expected = array( |
| 40 |
|
'suggestedQuery' => 'New Zealand AND sheep', |
| 41 |
|
'suggestedQueryHighlighted' => 'New <strong class="hl">Zealand</strong> AND sheep' |
| 42 |
|
); |
| 43 |
|
$this->assertEquals($expected, $pair); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
public function testOneIncorrectWord() { |
|
@@ 47-57 (lines=11) @@
|
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
public function testOneIncorrectWord() { |
| 48 |
|
$sa = $this->getSuggestionArray('New Zealind', |
| 49 |
|
'new zealand', |
| 50 |
|
'new <strong class="hl">zealand</strong>'); |
| 51 |
|
$pair = ElasticaUtil::getPhraseSuggestion($sa); |
| 52 |
|
$expected = array( |
| 53 |
|
'suggestedQuery' => 'New Zealand', |
| 54 |
|
'suggestedQueryHighlighted' => 'New <strong class="hl">Zealand</strong>' |
| 55 |
|
); |
| 56 |
|
$this->assertEquals($expected, $pair); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
public function testOneIncorrectWordLowerCase() { |
|
@@ 60-70 (lines=11) @@
|
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
public function testOneIncorrectWordLowerCase() { |
| 61 |
|
$sa = $this->getSuggestionArray('new zealind', |
| 62 |
|
'new zealand', |
| 63 |
|
'new <strong class="hl">zealand</strong>'); |
| 64 |
|
$pair = ElasticaUtil::getPhraseSuggestion($sa); |
| 65 |
|
$expected = array( |
| 66 |
|
'suggestedQuery' => 'new zealand', |
| 67 |
|
'suggestedQueryHighlighted' => 'new <strong class="hl">zealand</strong>' |
| 68 |
|
); |
| 69 |
|
$this->assertEquals($expected, $pair); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|