Skip to content

Commit e07cbaf

Browse files
author
okarpenko
committed
MAGETWO-36972: Expose CMS api's as web API
1 parent bc90ac5 commit e07cbaf

File tree

1 file changed

+19
-62
lines changed

1 file changed

+19
-62
lines changed

app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php

Lines changed: 19 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -225,42 +225,18 @@ public function testGetList()
225225
$storeFilter = $this->getMockBuilder('Magento\Framework\Api\Filter')->getMock();
226226
$sortOrder = $this->getMockBuilder('Magento\Framework\Api\SortOrder')->getMock();
227227

228-
$criteria->expects($this->once())
229-
->method('getFilterGroups')
230-
->willReturn([$filterGroup]);
231-
$criteria->expects($this->once())
232-
->method('getSortOrders')
233-
->willReturn([$sortOrder]);
234-
$criteria->expects($this->once())
235-
->method('getCurrentPage')
236-
->willReturn($currentPage);
237-
$criteria->expects($this->once())
238-
->method('getPageSize')
239-
->willReturn($pageSize);
240-
$filterGroup->expects($this->once())
241-
->method('getFilters')
242-
->willReturn([$storeFilter, $filter]);
243-
$filter->expects($this->once())
244-
->method('getConditionType')
245-
->willReturn($condition);
246-
$filter->expects($this->any())
247-
->method('getField')
248-
->willReturn($field);
249-
$filter->expects($this->once())
250-
->method('getValue')
251-
->willReturn($value);
252-
$storeFilter->expects($this->any())
253-
->method('getField')
254-
->willReturn('store_id');
255-
$storeFilter->expects($this->once())
256-
->method('getValue')
257-
->willReturn(1);
258-
$sortOrder->expects($this->once())
259-
->method('getField')
260-
->willReturn($sortField);
261-
$sortOrder->expects($this->once())
262-
->method('getDirection')
263-
->willReturn(SearchCriteriaInterface::SORT_DESC);
228+
$criteria->expects($this->once())->method('getFilterGroups')->willReturn([$filterGroup]);
229+
$criteria->expects($this->once())->method('getSortOrders')->willReturn([$sortOrder]);
230+
$criteria->expects($this->once())->method('getCurrentPage')->willReturn($currentPage);
231+
$criteria->expects($this->once())->method('getPageSize')->willReturn($pageSize);
232+
$filterGroup->expects($this->once())->method('getFilters')->willReturn([$storeFilter, $filter]);
233+
$filter->expects($this->once())->method('getConditionType')->willReturn($condition);
234+
$filter->expects($this->any())->method('getField')->willReturn($field);
235+
$filter->expects($this->once())->method('getValue')->willReturn($value);
236+
$storeFilter->expects($this->any())->method('getField')->willReturn('store_id');
237+
$storeFilter->expects($this->once())->method('getValue')->willReturn(1);
238+
$sortOrder->expects($this->once())->method('getField')->willReturn($sortField);
239+
$sortOrder->expects($this->once())->method('getDirection')->willReturn(SearchCriteriaInterface::SORT_DESC);
264240

265241
/** @var \Magento\Framework\Api\SearchCriteriaInterface $criteria */
266242

@@ -273,32 +249,13 @@ public function testGetList()
273249
->method('addFieldToFilter')
274250
->with($field, [$condition => $value])
275251
->willReturnSelf();
276-
$this->blockSearchResult->expects($this->once())
277-
->method('setTotalCount')
278-
->with($total)
279-
->willReturnSelf();
280-
$this->collection->expects($this->once())
281-
->method('getSize')
282-
->willReturn($total);
283-
$this->collection->expects($this->once())
284-
->method('setCurPage')
285-
->with($currentPage)
286-
->willReturnSelf();
287-
$this->collection->expects($this->once())
288-
->method('setPageSize')
289-
->with($pageSize)
290-
->willReturnSelf();
291-
$this->collection->expects($this->once())
292-
->method('addOrder')
293-
->with($sortField, 'DESC')
294-
->willReturnSelf();
295-
$this->block->expects($this->once())
296-
->method('getData')
297-
->willReturn(['data']);
298-
$this->blockSearchResult->expects($this->once())
299-
->method('setItems')
300-
->with(['someData'])
301-
->willReturnSelf();
252+
$this->blockSearchResult->expects($this->once())->method('setTotalCount')->with($total)->willReturnSelf();
253+
$this->collection->expects($this->once())->method('getSize')->willReturn($total);
254+
$this->collection->expects($this->once())->method('setCurPage')->with($currentPage)->willReturnSelf();
255+
$this->collection->expects($this->once())->method('setPageSize')->with($pageSize)->willReturnSelf();
256+
$this->collection->expects($this->once())->method('addOrder')->with($sortField, 'DESC')->willReturnSelf();
257+
$this->block->expects($this->once())->method('getData')->willReturn(['data']);
258+
$this->blockSearchResult->expects($this->once())->method('setItems')->with(['someData'])->willReturnSelf();
302259
$this->dataHelper->expects($this->once())
303260
->method('populateWithArray')
304261
->with($this->blockData, ['data'], 'Magento\Cms\Api\Data\BlockInterface');

0 commit comments

Comments
 (0)