public function testGetCountryForVirtualQuote() { $quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', [], [], '', false, false); $quoteMock->expects($this->once())->method('isVirtual')->willReturn(true); $addressMock = $this->getMock('Magento\\Quote\\Model\\Quote\\Address', [], [], '', false, false); $addressMock->expects($this->never())->method('getCountry'); $quoteMock->expects($this->never())->method('getShippingAddress'); $this->directoryMock->expects($this->once())->method('getDefaultCountry')->willReturn(10); $this->assertEquals(10, $this->model->getCountry($quoteMock)); }
/** * Check whether payment method is applicable to quote * @param MethodInterface $paymentMethod * @param Quote $quote * @return bool */ public function isApplicable(MethodInterface $paymentMethod, Quote $quote) { return $paymentMethod->canUseForCountry($this->countryProvider->getCountry($quote)); }