示例#1
0
 /**
  * test order comments list service
  */
 public function testInvoke()
 {
     $orderId = 1;
     $this->filterBuilderMock->expects($this->once())->method('setField')->with($this->equalTo('parent_id'))->will($this->returnSelf());
     $this->filterBuilderMock->expects($this->once())->method('setValue')->with($this->equalTo($orderId))->will($this->returnSelf());
     $this->filterBuilderMock->expects($this->once())->method('create')->will($this->returnValue('filter'));
     $this->criteriaBuilderMock->expects($this->once())->method('addFilter')->with($this->equalTo(['eq' => 'filter']))->will($this->returnSelf());
     $this->criteriaBuilderMock->expects($this->once())->method('create')->will($this->returnValue($this->searchCriteriaMock));
     $this->historyRepositoryMock->expects($this->once())->method('find')->with($this->equalTo($this->searchCriteriaMock))->will($this->returnValue([$this->orderCommentMock]));
     $this->historyMapperMock->expects($this->once())->method('extractDto')->with($this->equalTo($this->orderCommentMock))->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->orderCommentsList->invoke($orderId));
 }
示例#2
0
 /**
  * test order comments list
  */
 public function testCommentsList()
 {
     $this->orderCommentsListMock->expects($this->once())->method('invoke')->with(1)->will($this->returnValue('search_result'));
     $this->assertEquals('search_result', $this->orderRead->commentsList(1));
 }
示例#3
0
 /**
  * @param int $id
  * @return \Magento\Sales\Service\V1\Data\OrderStatusHistorySearchResults
  */
 public function commentsList($id)
 {
     return $this->orderCommentsList->invoke($id);
 }