コード例 #1
0
 /**
  * Test creditmemo list service
  *
  * @return void
  */
 public function testCreditmemo()
 {
     $this->creditmemoRepositoryMock->expects($this->once())->method('find')->with($this->equalTo($this->searchCriteriaMock))->will($this->returnValue([$this->creditmemoMock]));
     $this->creditmemoMapperMock->expects($this->once())->method('extractDto')->with($this->equalTo($this->creditmemoMock))->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(count($this->creditmemoMock)))->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->creditmemoList->invoke($this->searchCriteriaMock));
 }
コード例 #2
0
ファイル: CreditmemoRead.php プロジェクト: aiesh/magento2
 /**
  * @param SearchCriteria $searchCriteria
  * @return \Magento\Framework\Service\V1\Data\SearchResults
  */
 public function search(SearchCriteria $searchCriteria)
 {
     return $this->creditmemoList->invoke($searchCriteria);
 }