forked from solariumphp/solarium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDocumentSetTest.php
64 lines (53 loc) · 1.35 KB
/
DocumentSetTest.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
<?php
namespace Solarium\Tests\Component\Result\Debug;
use PHPUnit\Framework\TestCase;
use Solarium\Component\Result\Debug\Document;
use Solarium\Component\Result\Debug\DocumentSet;
class DocumentSetTest extends TestCase
{
/**
* @var DocumentSet
*/
protected $result;
protected $docs;
public function setUp(): void
{
$this->docs = [
'key1' => new Document('dummy1', true, 0.1, '', []),
'key2' => new Document('dummy2', false, 0.1, '', []),
];
$this->result = new DocumentSet($this->docs);
}
public function testGetDocument()
{
$this->assertEquals(
$this->docs['key1'],
$this->result->getDocument('key1')
);
}
public function testGetDocumentWithInvalidKey()
{
$this->assertNull(
$this->result->getDocument('invalidkey')
);
}
public function testGetDocuments()
{
$this->assertEquals(
$this->docs,
$this->result->getDocuments()
);
}
public function testIterator()
{
$items = [];
foreach ($this->result as $key => $item) {
$items[$key] = $item;
}
$this->assertEquals($this->docs, $items);
}
public function testCount()
{
$this->assertSameSize($this->docs, $this->result);
}
}