File: 203.solrquery_strict_types.phpt

package info (click to toggle)
php-solr 2.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,620 kB
  • sloc: ansic: 14,274; xml: 1,313; php: 1,239; pascal: 11; makefile: 3
file content (47 lines) | stat: -rw-r--r-- 1,134 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--TEST--
SolrQuery - Strict type parameters without BC break
--FILE--
<?php declare(strict_types=1);

$query = new SolrQuery('lucene');

$query->setStart(1);
$query->setRows(2);
$query->setTimeAllowed(300);
$query->setGroupOffset(1);
$query->setExpandRows(1);

echo $query . "\n";

// Now with strings
$query = new SolrQuery('lucene');
$query->setStart('1anystring'); // we don't do any checking
$query->setRows('2');
$query->setTimeAllowed('300');
$query->setGroupOffset('1');
$query->setExpandRows('1');

echo $query . "\n";

try { $query->setStart(true); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage() . "\n"; }

$collapse = new SolrCollapseFunction();
$collapse->setSize(1);

echo $collapse . "\n";

$d = new SolrDisMaxQuery('lucene');
$d->setPhraseSlop(2);
$d->setQueryPhraseSlop(3);
$d->setBigramPhraseSlop(4);
$d->setTrigramPhraseSlop(5);

echo $d . "\n";

--EXPECT--
q=lucene&start=1&rows=2&timeAllowed=300&group.offset=1&expand.rows=1
q=lucene&start=1anystring&rows=2&timeAllowed=300&group.offset=1&expand.rows=1
Argument 1 must be an int
{!collapse size=1}
q=lucene&defType=edismax&ps=2&qs=3&ps2=4&ps3=5