SearchQueryTest::testLimits()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 0
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
Deprecated Code introduced by
The function SilverStripe\FullTextSea...hQuery::addSearchTerm() has been deprecated: please use {@link self::addTerm()} ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

14
        $query = /** @scrutinizer ignore-deprecated */ $query->addSearchTerm('Test term', [], 2);

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.

Loading history...
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
Deprecated Code introduced by
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 ignore-deprecated  annotation

34
        /** @scrutinizer ignore-deprecated */ $query->setLimit(5);

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.

Loading history...
35
36
        $this->assertEquals(5, $query->getRows());
37
        $this->assertEquals(5, $query->getLimit());
0 ignored issues
show
Deprecated Code introduced by
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 ignore-deprecated  annotation

37
        $this->assertEquals(5, /** @scrutinizer ignore-deprecated */ $query->getLimit());

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.

Loading history...
38
    }
39
}
40