1 | <?php |
||||
2 | |||||
3 | |||||
4 | namespace Firesphere\SolrCompatibility\Tests; |
||||
5 | |||||
6 | use SilverStripe\Dev\SapphireTest; |
||||
7 | use SilverStripe\FullTextSearch\Search\Queries\SearchQuery; |
||||
8 | |||||
9 | class SearchQueryTest extends SapphireTest |
||||
10 | { |
||||
11 | public function testAddSearchTerm() |
||||
12 | { |
||||
13 | $query = new SearchQuery(); |
||||
14 | $query = $query->addSearchTerm('Test term', [], 2); |
||||
0 ignored issues
–
show
|
|||||
15 | |||||
16 | $expected = [ |
||||
17 | [ |
||||
18 | 'text' => 'Test term', |
||||
19 | 'fields' => |
||||
20 | [ |
||||
21 | ], |
||||
22 | 'boost' => 2, |
||||
23 | 'fuzzy' => null, |
||||
24 | ] |
||||
25 | ]; |
||||
26 | |||||
27 | $this->assertEquals($expected, $query->getTerms()); |
||||
28 | } |
||||
29 | |||||
30 | public function testLimits() |
||||
31 | { |
||||
32 | $query = new SearchQuery(); |
||||
33 | |||||
34 | $query->setLimit(5); |
||||
0 ignored issues
–
show
The function
SilverStripe\FullTextSea...SearchQuery::setLimit() has been deprecated: please use {@link self::setRows()}
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
35 | |||||
36 | $this->assertEquals(5, $query->getRows()); |
||||
37 | $this->assertEquals(5, $query->getLimit()); |
||||
0 ignored issues
–
show
The function
SilverStripe\FullTextSea...SearchQuery::getLimit() has been deprecated: please use {@link self::getRows()}
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
38 | } |
||||
39 | } |
||||
40 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.