forked from solariumphp/solarium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDebugTest.php
104 lines (81 loc) · 2.48 KB
/
DebugTest.php
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
namespace Solarium\Tests\Component\Result\Debug;
use PHPUnit\Framework\TestCase;
use Solarium\Component\Result\Debug\DocumentSet;
use Solarium\Component\Result\Debug\Result;
use Solarium\Component\Result\Debug\Timing;
class DebugTest extends TestCase
{
/**
* @var Result
*/
protected $result;
protected $queryString;
protected $queryParser;
protected $parsedQuery;
protected $otherQuery;
protected $explain;
protected $explainOther;
protected $explainData;
protected $timing;
public function setUp(): void
{
$this->queryString = 'dummy-querystring';
$this->parsedQuery = 'dummy-parsed-qs';
$this->queryParser = 'dummy-parser';
$this->otherQuery = 'id:67';
$this->explainData = ['a' => 'dummy1', 'b' => 'dummy2'];
$this->explain = new DocumentSet($this->explainData);
$this->explainOther = new DocumentSet(['dummy-other']);
$this->timing = new Timing(1.23, ['dummy-timing']);
$this->result = new Result(
$this->queryString,
$this->parsedQuery,
$this->queryParser,
$this->otherQuery,
$this->explain,
$this->explainOther,
$this->timing
);
}
public function testGetQueryString()
{
$this->assertEquals($this->queryString, $this->result->getQueryString());
}
public function testGetParsedQuery()
{
$this->assertEquals($this->parsedQuery, $this->result->getParsedQuery());
}
public function testGetQueryParser()
{
$this->assertEquals($this->queryParser, $this->result->getQueryParser());
}
public function testGetOtherQuery()
{
$this->assertEquals($this->otherQuery, $this->result->getOtherQuery());
}
public function testGetExplain()
{
$this->assertEquals($this->explain, $this->result->getExplain());
}
public function testGetExplainOther()
{
$this->assertEquals($this->explainOther, $this->result->getExplainOther());
}
public function testGetTiming()
{
$this->assertEquals($this->timing, $this->result->getTiming());
}
public function testIterator()
{
$items = [];
foreach ($this->result as $key => $item) {
$items[$key] = $item;
}
$this->assertEquals($this->explainData, $items);
}
public function testCount()
{
$this->assertSameSize($this->explain, $this->result);
}
}