@@ 126-138 (lines=13) @@ | ||
123 | /** |
|
124 | * @param array $schematicFieldModels |
|
125 | */ |
|
126 | private function setMockPluginsService(array $schematicFieldModels) |
|
127 | { |
|
128 | $mockPluginsService = $this->getMockBuilder(PluginsService::class) |
|
129 | ->disableOriginalConstructor() |
|
130 | ->getMock(); |
|
131 | ||
132 | $mockPluginsService->expects($this->exactly(1)) |
|
133 | ->method('call') |
|
134 | ->with('registerSchematicFieldModels') |
|
135 | ->willReturn($schematicFieldModels); |
|
136 | ||
137 | $this->setComponent(Craft::app(), 'plugins', $mockPluginsService); |
|
138 | } |
|
139 | } |
|
140 |
@@ 278-292 (lines=15) @@ | ||
275 | * |
|
276 | * @return Mock|SectionsService |
|
277 | */ |
|
278 | private function setMockSectionsService($indexBy) |
|
279 | { |
|
280 | $mockSectionService = $this->getMockBuilder(SectionsService::class) |
|
281 | ->disableOriginalConstructor() |
|
282 | ->getMock(); |
|
283 | ||
284 | $mockSectionService->expects($this->any()) |
|
285 | ->method('getAllSections') |
|
286 | ->with($indexBy) |
|
287 | ->willReturn($this->getMockSections($indexBy, 2)); |
|
288 | ||
289 | $this->setComponent(Craft::app(), 'sections', $mockSectionService); |
|
290 | ||
291 | return $mockSectionService; |
|
292 | } |
|
293 | ||
294 | /** |
|
295 | * @param string $indexBy |
|
@@ 328-342 (lines=15) @@ | ||
325 | * |
|
326 | * @return Mock|AssetSourcesService |
|
327 | */ |
|
328 | private function setMockAssetSourcesService($indexBy) |
|
329 | { |
|
330 | $mockAssetSourcesService = $this->getMockBuilder(AssetSourcesService::class) |
|
331 | ->disableOriginalConstructor() |
|
332 | ->getMock(); |
|
333 | ||
334 | $mockAssetSourcesService->expects($this->exactly(1)) |
|
335 | ->method('getAllSources') |
|
336 | ->with($indexBy) |
|
337 | ->willReturn($this->getMockAssetSources($indexBy, 1)); |
|
338 | ||
339 | $this->setComponent(Craft::app(), 'assetSources', $mockAssetSourcesService); |
|
340 | ||
341 | return $mockAssetSourcesService; |
|
342 | } |
|
343 | ||
344 | /** |
|
345 | * @param string $indexBy |
|
@@ 378-392 (lines=15) @@ | ||
375 | * |
|
376 | * @return Mock|AssetSourcesService |
|
377 | */ |
|
378 | private function setMockGlobalsService($indexBy) |
|
379 | { |
|
380 | $mockAssetSourcesService = $this->getMockBuilder(GlobalsService::class) |
|
381 | ->disableOriginalConstructor() |
|
382 | ->getMock(); |
|
383 | ||
384 | $mockAssetSourcesService->expects($this->exactly(1)) |
|
385 | ->method('getAllSets') |
|
386 | ->with($indexBy) |
|
387 | ->willReturn($this->getMockGlobalSets($indexBy, 1)); |
|
388 | ||
389 | $this->setComponent(Craft::app(), 'globals', $mockAssetSourcesService); |
|
390 | ||
391 | return $mockAssetSourcesService; |
|
392 | } |
|
393 | ||
394 | /** |
|
395 | * @param string $indexBy |