1 | <?php |
||
29 | class ElementIndexSettingsTest extends BaseTest |
||
30 | { |
||
31 | /** |
||
32 | * @var ElementIndexSettings |
||
33 | */ |
||
34 | private $schematicElementIndexSettingsService; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function setUp() |
||
45 | |||
46 | /** |
||
47 | * @return ElementsService|Mock |
||
48 | * |
||
49 | * @param array $getAllElementTypesResponse |
||
50 | * |
||
51 | * @return Mock |
||
52 | */ |
||
53 | protected function getMockElementsService($getAllElementTypesResponse = []) |
||
60 | |||
61 | /** |
||
62 | * @return ElementIndexesService|Mock |
||
63 | * @return Mock |
||
64 | */ |
||
65 | protected function getMockElementIndexesService() |
||
66 | { |
||
67 | $getSettingsResponse = $this->getElementIndexSettingsSavedData(); |
||
68 | $mock = $this->getMockBuilder(ElementIndexesService::class)->getMock(); |
||
69 | $mock->expects($this->any())->method('getSettings')->will($this->returnValueMap([ |
||
70 | ['Entry', $getSettingsResponse['Entry']], |
||
71 | ['Category', $getSettingsResponse['Category']], |
||
72 | ])); |
||
73 | $mock->expects($this->any())->method('saveSettings')->willReturn(false); |
||
74 | |||
75 | return $mock; |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * Test default import functionality. |
||
80 | * |
||
81 | * @covers ::import |
||
82 | */ |
||
83 | public function testImport() |
||
94 | |||
95 | /** |
||
96 | * Test export functionality. |
||
97 | * |
||
98 | * @covers ::export |
||
99 | */ |
||
100 | public function testExport() |
||
113 | |||
114 | /** |
||
115 | * Returns elements data. |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | public function getElementsData() |
||
126 | |||
127 | /** |
||
128 | * Returns element index settings saved data. |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | private function getElementIndexSettingsSavedData() |
||
172 | |||
173 | /** |
||
174 | * Returns element index settings exported data. |
||
175 | * |
||
176 | * @return array |
||
177 | */ |
||
178 | private function getElementIndexSettingsExportedData() |
||
218 | |||
219 | /** |
||
220 | * @return Mock|Sources |
||
221 | */ |
||
222 | private function setMockSources() |
||
236 | |||
237 | /** |
||
238 | * @param string $fieldType |
||
239 | * @param string $source |
||
240 | * @param string $fromIndex |
||
241 | * @param string $toIndex |
||
242 | * |
||
243 | * @return string |
||
244 | */ |
||
245 | public function getMockSourceCallback($fieldType, $source, $fromIndex, $toIndex) |
||
260 | |||
261 | /** |
||
262 | * @return Mock|CraftFieldsService |
||
263 | */ |
||
264 | private function setMockFieldsService() |
||
279 | } |
||
280 |