예제 #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
 /**
  * @param SearchCriteria $searchCriteria
  * @return \Magento\Framework\Service\V1\Data\SearchResults
  */
 public function search(SearchCriteria $searchCriteria)
 {
     return $this->creditmemoList->invoke($searchCriteria);
 }
예제 #3
0
 /**
  * test creditmemo list
  */
 public function testSearch()
 {
     $searchCriteria = $this->getMock('Magento\\Framework\\Service\\V1\\Data\\SearchCriteria', [], [], '', false);
     $this->creditmemoListMock->expects($this->once())->method('invoke')->with($searchCriteria)->will($this->returnValue('search_result'));
     $this->assertEquals('search_result', $this->creditmemoRead->search($searchCriteria));
 }