public function testGetList() { $cartId = 834; $this->quoteRepositoryMock->expects($this->once())->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(3)); $this->quoteMock->expects($this->once())->method('getShippingAddress')->will($this->returnValue($this->shippingAddressMock)); $this->shippingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(345)); $this->shippingAddressMock->expects($this->once())->method('collectShippingRates'); $shippingRateMock = $this->getMock('\\Magento\\Sales\\Model\\Quote\\Address\\Rate', [], [], '', false); $this->shippingAddressMock->expects($this->once())->method('getGroupedAllShippingRates')->will($this->returnValue([[$shippingRateMock]])); $currencyCode = 'EUR'; $this->quoteMock->expects($this->once())->method('getQuoteCurrencyCode')->will($this->returnValue($currencyCode)); $this->converterMock->expects($this->once())->method('modelToDataObject')->with($shippingRateMock, $currencyCode)->will($this->returnValue('RateValue')); $this->assertEquals(['RateValue'], $this->service->getList($cartId)); }