1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Zikula package. |
7
|
|
|
* |
8
|
|
|
* Copyright Zikula Foundation - https://ziku.la/ |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Zikula\SearchModule\Tests\Api\Fixtures; |
15
|
|
|
|
16
|
|
|
use Doctrine\Common\Collections\Criteria; |
17
|
|
|
use Zikula\Bundle\CoreBundle\Doctrine\Paginator; |
18
|
|
|
use Zikula\SearchModule\Entity\RepositoryInterface\SearchResultRepositoryInterface; |
19
|
|
|
use Zikula\SearchModule\Entity\SearchResultEntity; |
20
|
|
|
|
21
|
|
|
class MockSearchResultRepository implements SearchResultRepositoryInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var SearchResultEntity[] |
25
|
|
|
*/ |
26
|
|
|
private $results = []; |
27
|
|
|
|
28
|
|
|
public function getResults(array $filters = [], array $sorting = [], int $page = 1, int $pageSize = 25): Paginator |
29
|
|
|
{ |
30
|
|
|
return $this->results; |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function clearOldResults(string $sessionId = ''): void |
34
|
|
|
{ |
35
|
|
|
foreach ($this->results as $k => $result) { |
36
|
|
|
if ($sessionId === $result->getSesid()) { |
37
|
|
|
unset($this->results[$k]); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function persist(SearchResultEntity $entity): void |
43
|
|
|
{ |
44
|
|
|
$this->results[] = $entity; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function flush(SearchResultEntity $entity = null): void |
48
|
|
|
{ |
49
|
|
|
// nothing |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function truncateTable(): void |
53
|
|
|
{ |
54
|
|
|
// nothing |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function find($id) |
58
|
|
|
{ |
59
|
|
|
// TODO: Implement find() method. |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function findAll() |
63
|
|
|
{ |
64
|
|
|
// TODO: Implement findAll() method. |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
68
|
|
|
{ |
69
|
|
|
// TODO: Implement findBy() method. |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function findOneBy(array $criteria) |
73
|
|
|
{ |
74
|
|
|
// TODO: Implement findOneBy() method. |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getClassName() |
78
|
|
|
{ |
79
|
|
|
// TODO: Implement getClassName() method. |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function matching(Criteria $criteria) |
83
|
|
|
{ |
84
|
|
|
// TODO: Implement matching() method. |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|