The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit 49be75b8 authored by Demian Katz's avatar Demian Katz Committed by Robert Lange
Browse files

Fix spell check handling of numeric terms. (#1515)

- Thanks to Katy Earl for reporting the problem and proposing a fix.
parent 6449de64
Branches
Tags
No related merge requests found
......@@ -165,7 +165,7 @@ class Spellcheck implements IteratorAggregate, Countable
*
* @return bool
*/
protected function contains($term)
protected function contains(string $term)
{
if ($this->terms->offsetExists($term)) {
return true;
......
......@@ -53,7 +53,8 @@ class SpellcheckTest extends TestCase
[
['this is a phrase', []],
['foo', []],
['foobar', []]
['foobar', []],
['1842', []], // test numeric handling (can cause problems)
],
'fake query'
);
......@@ -61,13 +62,27 @@ class SpellcheckTest extends TestCase
[
['is a', []],
['bar', []],
['foo bar', []]
['foo bar', []],
['1842', []],
['1843', []]
],
'fake query'
);
$s1->mergeWith($s2);
$this->assertCount(5, $s1);
$this->assertCount(7, $s1);
$this->assertEquals($s2, $s1->getSecondary());
$this->assertEquals(
[
'this is a phrase' => [],
'foobar' => [],
'foo' => [],
'bar' => [],
'foo bar' => [],
'1842' => [],
'1843' => [],
],
iterator_to_array($s1->getIterator())
);
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment