public function testCollectRates() { $this->mockIsActive(true); $this->mockGetLocations(); $this->mockBuildRateForLocation(); $this->rateResult->expects($this->once())->method('append')->with($this->method); $result = $this->model->collectRates(new \Magento\Framework\Object()); $this->assertInstanceOf('Magento\\Shipping\\Model\\Rate\\Result', $result); }
/** * Replace shipping address with pickup location address * * @param CheckoutOnePage $subject * @param array $result * @return $this */ public function afterSaveShippingMethod(CheckoutOnePage $subject, array $result) { if ($result) { return $result; } $quote = $subject->getQuote(); $shippingAddress = $quote->getShippingAddress(); $shippingMethod = $shippingAddress->getShippingMethod(); /** * In-Store pickup selected * Update Shipping Address */ if (strpos($shippingMethod, $this->carrier->getCarrierCode()) !== false) { $locationAddress = $this->carrier->getLocationInfo($shippingMethod); $shippingAddress->setCountryId($locationAddress['country_id']); $shippingAddress->setRegionId($locationAddress['region_id']); $shippingAddress->setPostcode($locationAddress['postcode']); $shippingAddress->setCity($locationAddress['city']); $shippingAddress->setStreet($locationAddress['street']); $shippingAddress->setTelephone($locationAddress['phone']); } return $result; }