public function testGetList() { $filter = $this->getMock('Magento\\Framework\\Api\\Filter', ['getConditionType', 'getField', 'getValue'], [], '', false); $filter->expects($this->any())->method('getConditionType')->willReturn(false); $filter->expects($this->any())->method('getField')->willReturn('test_field'); $filter->expects($this->any())->method('getValue')->willReturn('test_value'); $filterGroup = $this->getMock('Magento\\Framework\\Api\\Search\\FilterGroup', ['getFilters'], [], '', false); $filterGroup->expects($this->once())->method('getFilters')->willReturn([$filter]); $searchCriteria = $this->getMock('Magento\\Framework\\Api\\SearchCriteria', ['getFilterGroups'], [], '', false); $searchCriteria->expects($this->once())->method('getFilterGroups')->willReturn([$filterGroup]); $collection = $this->getMock('Magento\\Sales\\Model\\ResourceModel\\Order\\Address\\Collection', ['addFieldToFilter'], [], '', false); $collection->expects($this->once())->method('addFieldToFilter')->withAnyParameters(); $this->searchResultFactory->expects($this->once())->method('create')->willReturn($collection); $this->assertEquals($collection, $this->subject->getList($searchCriteria)); }