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\ArrayCollection; |
17
|
|
|
use Zikula\Bundle\CoreBundle\Doctrine\PaginatorInterface; |
18
|
|
|
|
19
|
|
|
class MockPaginator implements PaginatorInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var ArrayCollection |
23
|
|
|
*/ |
24
|
|
|
private $results; |
25
|
|
|
|
26
|
|
|
public function __construct(array $results = []) |
27
|
|
|
{ |
28
|
|
|
$this->results = new ArrayCollection($results); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function paginate(int $page = 1): PaginatorInterface |
32
|
|
|
{ |
33
|
|
|
return $this; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function getCurrentPage(): int |
37
|
|
|
{ |
38
|
|
|
return 1; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function getLastPage(): int |
42
|
|
|
{ |
43
|
|
|
return 2; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getPageSize(): int |
47
|
|
|
{ |
48
|
|
|
return 1000; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function hasPreviousPage(): bool |
52
|
|
|
{ |
53
|
|
|
return false; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function getPreviousPage(): int |
57
|
|
|
{ |
58
|
|
|
return 1; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function hasNextPage(): bool |
62
|
|
|
{ |
63
|
|
|
return true; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function getNextPage(): int |
67
|
|
|
{ |
68
|
|
|
return 2; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function hasToPaginate(): bool |
72
|
|
|
{ |
73
|
|
|
return true; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function getNumResults(): int |
77
|
|
|
{ |
78
|
|
|
return $this->results->count(); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function getResults(): \Traversable |
82
|
|
|
{ |
83
|
|
|
return $this->results; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function setRoute(string $route): PaginatorInterface |
87
|
|
|
{ |
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function getRoute(): string |
92
|
|
|
{ |
93
|
|
|
return ''; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function setRouteParameters(array $parameters): PaginatorInterface |
97
|
|
|
{ |
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function setRouteParameter(string $name, string $value): void |
102
|
|
|
{ |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function getRouteParameters(): array |
106
|
|
|
{ |
107
|
|
|
return []; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function setTemplate(string $templateName): void |
111
|
|
|
{ |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getTemplate(): string |
115
|
|
|
{ |
116
|
|
|
return ''; |
117
|
|
|
} |
118
|
|
|
} |
119
|
|
|
|