Example #1
0
 /**
  * test order list service
  */
 public function testInvoke()
 {
     $this->orderRepositoryMock->expects($this->once())->method('find')->with($this->equalTo($this->searchCriteriaMock))->will($this->returnValue([$this->orderMock]));
     $this->orderMapperMock->expects($this->once())->method('extractDto')->with($this->equalTo($this->orderMock))->will($this->returnValue($this->dataObjectMock));
     $this->searchResultsBuilderMock->expects($this->once())->method('setItems')->with($this->equalTo([$this->dataObjectMock]))->will($this->returnSelf());
     $this->searchResultsBuilderMock->expects($this->once())->method('setTotalCount')->with($this->equalTo(1))->will($this->returnSelf());
     $this->searchResultsBuilderMock->expects($this->once())->method('setSearchCriteria')->with($this->equalTo($this->searchCriteriaMock))->will($this->returnSelf());
     $this->searchResultsBuilderMock->expects($this->once())->method('create')->will($this->returnValue('expected-result'));
     $this->assertEquals('expected-result', $this->orderList->invoke($this->searchCriteriaMock));
 }
Example #2
0
 /**
  * test order list
  */
 public function testSearch()
 {
     $searchCriteria = $this->getMock('Magento\\Framework\\Service\\V1\\Data\\SearchCriteria', [], [], '', false);
     $this->orderListMock->expects($this->once())->method('invoke')->with($searchCriteria)->will($this->returnValue('search_result'));
     $this->assertEquals('search_result', $this->orderRead->search($searchCriteria));
 }
Example #3
0
 /**
  * @param \Magento\Framework\Service\V1\Data\SearchCriteria $searchCriteria
  * @return \Magento\Sales\Service\V1\Data\OrderSearchResults
  */
 public function search(SearchCriteria $searchCriteria)
 {
     return $this->orderList->invoke($searchCriteria);
 }