public function testGetTotals() { $cartId = 12; $this->quoteRepositoryMock->expects($this->once())->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->setCartTotalsExpectations(); $this->setCartItemTotalsExpectations(); $this->service->getTotals($cartId); }
/** * @expectedException \Magento\Framework\Exception\InputException * @expectedExceptionMessage Field 'any_value' cannot be used for search. */ public function testGetCartListWithNotExistingField() { $searchCriteriaMock = $this->getMock('\\Magento\\Framework\\Service\\V1\\Data\\SearchCriteria', [], [], '', false); $this->searchResultsBuilderMock->expects($this->once())->method('setSearchCriteria')->will($this->returnValue($searchCriteriaMock)); $filterGroupMock = $this->getMock('\\Magento\\Framework\\Service\\V1\\Data\\Search\\FilterGroup', [], [], '', false); $searchCriteriaMock->expects($this->any())->method('getFilterGroups')->will($this->returnValue([$filterGroupMock])); $filterMock = $this->getMock('\\Magento\\Framework\\Service\\V1\\Data\\Filter', [], [], '', false); $filterGroupMock->expects($this->any())->method('getFilters')->will($this->returnValue([$filterMock])); $filterMock->expects($this->once())->method('getField')->will($this->returnValue('any_value')); $filterMock->expects($this->never())->method('getConditionType'); $this->service->getCartList($searchCriteriaMock); }