當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Address::expects方法代碼示例

本文整理匯總了PHP中Magento\Quote\Model\Quote\Address::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP Address::expects方法的具體用法?PHP Address::expects怎麽用?PHP Address::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Quote\Model\Quote\Address的用法示例。


在下文中一共展示了Address::expects方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetShippingDataObject

 /**
  * @param array $addressData
  * @param bool $useBaseCurrency
  * @param string $shippingTaxClass
  * @param bool shippingPriceInclTax
  * @param array $expectedValue
  * @dataProvider getShippingDataObjectDataProvider
  */
 public function testGetShippingDataObject(array $addressData, $useBaseCurrency, $shippingTaxClass, $shippingPriceInclTax)
 {
     $baseShippingAmount = $addressData['base_shipping_amount'];
     $shippingAmount = $addressData['shipping_amount'];
     $itemMock = $this->getMock('Magento\\Tax\\Api\\Data\\QuoteDetailsItemInterface');
     $this->taxConfig->expects($this->any())->method('getShippingTaxClass')->with($this->store)->will($this->returnValue($shippingTaxClass));
     $this->taxConfig->expects($this->any())->method('shippingPriceIncludesTax')->with($this->store)->will($this->returnValue($shippingPriceInclTax));
     $this->address->expects($this->atLeastOnce())->method('getShippingDiscountAmount')->willReturn($shippingAmount);
     if ($shippingAmount) {
         if ($useBaseCurrency && $shippingAmount != 0) {
             $this->address->expects($this->once())->method('getBaseShippingDiscountAmount')->willReturn($baseShippingAmount);
             $this->quoteDetailsItemBuilderMock->expects($this->once())->method('setDiscountAmount')->with($baseShippingAmount);
         } else {
             $this->address->expects($this->never())->method('getBaseShippingDiscountAmount');
             $this->quoteDetailsItemBuilderMock->expects($this->once())->method('setDiscountAmount')->with($shippingAmount);
         }
     }
     foreach ($addressData as $key => $value) {
         $this->address->setData($key, $value);
     }
     $this->taxClassKeyBuilderMock->expects($this->any())->method('setType')->willReturnSelf();
     $this->taxClassKeyBuilderMock->expects($this->any())->method('setValue')->with($shippingTaxClass)->willReturnSelf();
     $this->quoteDetailsItemBuilderMock->expects($this->once())->method('create')->willReturn($itemMock);
     $this->assertEquals($itemMock, $this->commonTaxCollector->getShippingDataObject($this->address, $useBaseCurrency));
 }
開發者ID:ViniciusAugusto,項目名稱:magento2,代碼行數:33,代碼來源:CommonTaxCollectorTest.php

示例2: disabledQuoteAddressValidationStep

 /**
  * @param \PHPUnit_Framework_MockObject_MockObject $quoteMock
  */
 private function disabledQuoteAddressValidationStep(\PHPUnit_Framework_MockObject_MockObject $quoteMock)
 {
     $billingAddressMock = $this->getBillingAddressMock($quoteMock);
     $billingAddressMock->expects(self::once())->method('setShouldIgnoreValidation')->with(true)->willReturnSelf();
     $this->shippingAddressMock->expects(self::once())->method('setShouldIgnoreValidation')->with(true)->willReturnSelf();
     $billingAddressMock->expects(self::at(1))->method('getEmail')->willReturn(self::TEST_EMAIL);
     $billingAddressMock->expects(self::never())->method('setSameAsBilling');
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:11,代碼來源:ShippingMethodUpdaterTest.php

示例3: testCollect

 public function testCollect()
 {
     $this->shippingAssignment->expects($this->exactly(3))->method('getShipping')->willReturn($this->shipping);
     $this->shipping->expects($this->exactly(2))->method('getAddress')->willReturn($this->address);
     $this->shipping->expects($this->once())->method('getMethod')->willReturn('flatrate');
     $this->shippingAssignment->expects($this->atLeastOnce())->method('getItems')->willReturn([$this->cartItem]);
     $this->freeShipping->expects($this->once())->method('isFreeShipping')->with($this->quote, [$this->cartItem])->willReturn(true);
     $this->address->expects($this->once())->method('setFreeShipping')->with(true);
     $this->total->expects($this->atLeastOnce())->method('setTotalAmount');
     $this->total->expects($this->atLeastOnce())->method('setBaseTotalAmount');
     $this->cartItem->expects($this->atLeastOnce())->method('getProduct')->willReturnSelf();
     $this->cartItem->expects($this->atLeastOnce())->method('isVirtual')->willReturn(false);
     $this->cartItem->expects($this->once())->method('getParentItem')->willReturn(false);
     $this->cartItem->expects($this->once())->method('getHasChildren')->willReturn(false);
     $this->cartItem->expects($this->once())->method('getWeight')->willReturn(2);
     $this->cartItem->expects($this->atLeastOnce())->method('getQty')->willReturn(2);
     $this->address->expects($this->once())->method('getFreeShipping')->willReturn(true);
     $this->cartItem->expects($this->once())->method('setRowWeight')->with(0);
     $this->address->expects($this->once())->method('setItemQty')->with(2);
     $this->address->expects($this->atLeastOnce())->method('setWeight');
     $this->address->expects($this->atLeastOnce())->method('setFreeMethodWeight');
     $this->address->expects($this->once())->method('collectShippingRates');
     $this->address->expects($this->once())->method('getAllShippingRates')->willReturn([$this->rate]);
     $this->rate->expects($this->once())->method('getCode')->willReturn('flatrate');
     $this->quote->expects($this->once())->method('getStore')->willReturn($this->store);
     $this->rate->expects($this->atLeastOnce())->method('getPrice')->willReturn(5);
     $this->priceCurrency->expects($this->once())->method('convert')->with(5, $this->store)->willReturn(5);
     $this->total->expects($this->once())->method('setShippingAmount')->with(5);
     $this->rate->expects($this->once())->method('getCarrierTitle')->willReturn('Carrier title');
     $this->rate->expects($this->once())->method('getMethodTitle')->willReturn('Method title');
     $this->address->expects($this->once())->method('setShippingDescription')->with('Carrier title - Method title');
     $this->address->expects($this->once())->method('getShippingDescription')->willReturn('Carrier title - Method title');
     $this->total->expects($this->once())->method('setShippingDescription')->with('Carrier title - Method title');
     $this->shippingModel->collect($this->quote, $this->shippingAssignment, $this->total);
 }
開發者ID:nblair,項目名稱:magescotch,代碼行數:35,代碼來源:ShippingTest.php

示例4: testPrepareQuoteForNewCustomer

 public function testPrepareQuoteForNewCustomer()
 {
     $customerAddressMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AddressInterface')->disableOriginalConstructor()->getMock();
     $this->addressMock->expects($this->any())->method('exportCustomerAddress')->willReturn($customerAddressMock);
     $this->addressMock->expects($this->any())->method('getData')->willReturn([]);
     $this->addressFactoryMock->expects($this->any())->method('create')->willReturn($this->addressMock);
     $this->quoteMock->expects($this->any())->method('isVirtual')->willReturn(false);
     $this->quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($this->addressMock);
     $this->quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($this->addressMock);
     $customerDataMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->disableOriginalConstructor()->getMock();
     $this->customerFactoryMock->expects($this->once())->method('create')->willReturn($customerDataMock);
     $this->copyObjectMock->expects($this->any())->method('getDataFromFieldset')->willReturn([]);
     $this->dataObjectHelper->expects($this->any())->method('populateWithArray')->willReturnSelf();
     $this->assertInstanceOf('Magento\\Quote\\Model\\Quote', $this->quote->prepareQuoteForNewCustomer($this->quoteMock));
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:15,代碼來源:QuoteTest.php

示例5: testPopulateCustomerInfo

 public function testPopulateCustomerInfo()
 {
     $this->quoteMock->expects($this->once())->method('getCustomer')->willReturn($this->customerMock);
     $this->customerMock->expects($this->atLeastOnce())->method('getId')->willReturn(null);
     $this->customerMock->expects($this->atLeastOnce())->method('getDefaultBilling')->willReturn(100500);
     $this->quoteMock->expects($this->atLeastOnce())->method('getBillingAddress')->willReturn($this->quoteAddressMock);
     $this->quoteMock->expects($this->atLeastOnce())->method('getShippingAddress')->willReturn($this->quoteAddressMock);
     $this->quoteMock->expects($this->atLeastOnce())->method('setCustomer')->with($this->customerMock)->willReturnSelf();
     $this->quoteMock->expects($this->once())->method('getPasswordHash')->willReturn('password hash');
     $this->quoteAddressMock->expects($this->atLeastOnce())->method('getId')->willReturn(null);
     $this->customerAddressRepositoryMock->expects($this->atLeastOnce())->method('getById')->with(100500)->willReturn($this->customerAddressMock);
     $this->quoteAddressMock->expects($this->atLeastOnce())->method('importCustomerAddressData')->willReturnSelf();
     $this->accountManagementMock->expects($this->once())->method('createAccountWithPasswordHash')->with($this->customerMock, 'password hash')->willReturn($this->customerMock);
     $this->customerManagement->populateCustomerInfo($this->quoteMock);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:15,代碼來源:CustomerManagementTest.php

示例6: testAfterConvertNullExtensionAttribute

 /**
  * @dataProvider afterConvertDataProvider
  */
 public function testAfterConvertNullExtensionAttribute($appliedTaxes, $itemsAppliedTaxes)
 {
     $this->model->beforeConvert($this->subjectMock, $this->quoteAddressMock);
     $this->quoteAddressMock->expects($this->once())->method('getAppliedTaxes')->willReturn($appliedTaxes);
     $this->quoteAddressMock->expects($this->once())->method('getItemsAppliedTaxes')->willReturn($itemsAppliedTaxes);
     $orderExtensionAttributeMock = $this->setupOrderExtensionAttributeMock();
     $orderMock = $this->getMockBuilder('\\Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock();
     $orderMock->expects($this->once())->method('getExtensionAttributes')->willReturn(null);
     $this->orderExtensionFactoryMock->expects($this->once())->method('create')->willReturn($orderExtensionAttributeMock);
     $orderExtensionAttributeMock->expects($this->once())->method('setAppliedTaxes')->with($appliedTaxes);
     $orderExtensionAttributeMock->expects($this->once())->method('setConvertingFromQuote')->with(true);
     $orderExtensionAttributeMock->expects($this->once())->method('setItemAppliedTaxes')->with($itemsAppliedTaxes);
     $orderMock->expects($this->once())->method('setExtensionAttributes')->with($orderExtensionAttributeMock);
     $this->assertEquals($orderMock, $this->model->afterConvert($this->subjectMock, $orderMock));
 }
開發者ID:niranjanssiet,項目名稱:magento2,代碼行數:18,代碼來源:ToOrderConverterTest.php

示例7: updateBillingAddressStep

 /**
  * @param array $details
  */
 private function updateBillingAddressStep(array $details)
 {
     $this->configMock->expects(self::once())->method('isRequiredBillingAddress')->willReturn(true);
     $this->updateAddressDataStep($this->billingAddressMock, $details['billingAddress']);
     $this->billingAddressMock->expects(self::once())->method('setLastname')->with($details['lastName']);
     $this->billingAddressMock->expects(self::once())->method('setFirstname')->with($details['firstName']);
     $this->billingAddressMock->expects(self::once())->method('setEmail')->with($details['email']);
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:11,代碼來源:QuoteUpdaterTest.php

示例8: setUp

 public function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->taxConfig = $this->getMockBuilder('\\Magento\\Tax\\Model\\Config')->disableOriginalConstructor()->setMethods(['getShippingTaxClass', 'shippingPriceIncludesTax'])->getMock();
     $this->store = $this->getMockBuilder('\\Magento\\Store\\Model\\Store')->disableOriginalConstructor()->setMethods(['__wakeup'])->getMock();
     $this->quote = $this->getMockBuilder('\\Magento\\Quote\\Model\\Quote')->disableOriginalConstructor()->setMethods(['__wakeup', 'getStore'])->getMock();
     $this->quote->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
     $this->address = $this->getMockBuilder('\\Magento\\Quote\\Model\\Quote\\Address')->disableOriginalConstructor()->getMock();
     $this->address->expects($this->any())->method('getQuote')->will($this->returnValue($this->quote));
     $methods = ['create'];
     $this->quoteDetailsItemDataObject = $objectManager->getObject('Magento\\Tax\\Model\\Sales\\Quote\\ItemDetails');
     $this->taxClassKeyDataObject = $objectManager->getObject('Magento\\Tax\\Model\\TaxClass\\Key');
     $this->quoteDetailsItemDataObjectFactoryMock = $this->getMock('Magento\\Tax\\Api\\Data\\QuoteDetailsItemInterfaceFactory', $methods, [], '', false);
     $this->quoteDetailsItemDataObjectFactoryMock->expects($this->any())->method('create')->willReturn($this->quoteDetailsItemDataObject);
     $this->taxClassKeyDataObjectFactoryMock = $this->getMock('Magento\\Tax\\Api\\Data\\TaxClassKeyInterfaceFactory', $methods, [], '', false);
     $this->taxClassKeyDataObjectFactoryMock->expects($this->any())->method('create')->willReturn($this->taxClassKeyDataObject);
     $this->commonTaxCollector = $objectManager->getObject('Magento\\Tax\\Model\\Sales\\Total\\Quote\\CommonTaxCollector', ['taxConfig' => $this->taxConfig, 'quoteDetailsItemDataObjectFactory' => $this->quoteDetailsItemDataObjectFactoryMock, 'taxClassKeyDataObjectFactory' => $this->taxClassKeyDataObjectFactoryMock]);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:18,代碼來源:CommonTaxCollectorTest.php

示例9: testAfterSaveShippingMethod

 public function testAfterSaveShippingMethod()
 {
     $this->shippingAddress->expects($this->once())->method('getShippingMethod')->willReturn('storepickup_store_1');
     $this->shippingAddress->expects($this->once())->method('setCountryId')->with($this->locationData['country_id']);
     $this->shippingAddress->expects($this->once())->method('setRegionId')->with($this->locationData['region_id']);
     $this->shippingAddress->expects($this->once())->method('setPostcode')->with($this->locationData['postcode']);
     $this->shippingAddress->expects($this->once())->method('setCity')->with($this->locationData['city']);
     $this->shippingAddress->expects($this->once())->method('setStreet')->with($this->locationData['street']);
     $this->shippingAddress->expects($this->once())->method('setTelephone')->with($this->locationData['phone']);
     $this->model->afterSaveShippingMethod($this->subject, []);
 }
開發者ID:marcinNS,項目名稱:magento2-samples,代碼行數:11,代碼來源:OnepageTest.php

示例10: testValidateMiniumumAmountNegative

 public function testValidateMiniumumAmountNegative()
 {
     $storeId = 1;
     $this->quote->setStoreId($storeId);
     $valueMap = [['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true], ['sales/minimum_order/multi_address', ScopeInterface::SCOPE_STORE, $storeId, true], ['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20], ['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true]];
     $this->scopeConfig->expects($this->any())->method('isSetFlag')->will($this->returnValueMap($valueMap));
     $this->quoteAddressMock->expects($this->once())->method('validateMinimumAmount')->willReturn(false);
     $this->quoteAddressCollectionMock->expects($this->once())->method('setQuoteFilter')->willReturn([$this->quoteAddressMock]);
     $this->assertFalse($this->quote->validateMinimumAmount());
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:10,代碼來源:QuoteTest.php

示例11: testCalculate

 /**
  * @covers \Magento\SalesRule\Model\Rule\Action\Discount\CartFixed::calculate
  */
 public function testCalculate()
 {
     $this->rule->setData(['id' => 1, 'discount_amount' => 10.0]);
     $this->address->expects($this->any())->method('getCartFixedRules')->will($this->returnValue([]));
     $store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $this->priceCurrency->expects($this->atLeastOnce())->method('convert')->will($this->returnArgument(0));
     $this->priceCurrency->expects($this->atLeastOnce())->method('round')->will($this->returnArgument(0));
     $this->quote->expects($this->any())->method('getStore')->will($this->returnValue($store));
     /** validators data */
     $this->validator->expects($this->once())->method('getItemPrice')->with($this->item)->will($this->returnValue(100));
     $this->validator->expects($this->once())->method('getItemBasePrice')->with($this->item)->will($this->returnValue(100));
     $this->validator->expects($this->once())->method('getItemOriginalPrice')->with($this->item)->will($this->returnValue(100));
     $this->validator->expects($this->once())->method('getItemBaseOriginalPrice')->with($this->item)->will($this->returnValue(100));
     $this->address->expects($this->once())->method('setCartFixedRules')->with([1 => 0.0]);
     $this->model->calculate($this->rule, $this->item, 1);
     $this->assertEquals($this->data->getAmount(), 10);
     $this->assertEquals($this->data->getBaseAmount(), 10);
     $this->assertEquals($this->data->getOriginalAmount(), 10);
     $this->assertEquals($this->data->getBaseOriginalAmount(), 100);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:23,代碼來源:CartFixedTest.php

示例12: setupAddressMock

 /**
  * @param null|int $shippingAmount
  * @return \PHPUnit_Framework_MockObject_MockObject
  */
 protected function setupAddressMock($shippingAmount = null)
 {
     $storeMock = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->setMethods([])->getMock();
     $quoteMock = $this->getMockBuilder('Magento\\Quote\\Model\\Quote')->disableOriginalConstructor()->setMethods(['setAppliedRuleIds', 'getStore'])->getMock();
     $quoteMock->expects($this->any())->method('getStore')->willReturn($storeMock);
     $quoteMock->expects($this->any())->method('setAppliedRuleIds')->willReturnSelf();
     $this->addressMock->expects($this->any())->method('getShippingAmountForDiscount')->willReturn($shippingAmount);
     $this->addressMock->expects($this->any())->method('getQuote')->willReturn($quoteMock);
     $this->addressMock->expects($this->any())->method('getCustomAttributesCodes')->willReturn([]);
     return $this->addressMock;
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:15,代碼來源:ValidatorTest.php

示例13: testInitializeQuoteForReview

    /**
     * @dataProvider initializeQuoteForReviewDataProvider
     */
    public function testInitializeQuoteForReview(
        $paymentMethodNonce,
        $details,
        $expectedShipping,
        $expectedBilling,
        $expectedPaymentAdditionalInfo
    ) {
        $this->verifyIgnoreAddressValidation();
        $this->quoteMock->expects($this->any())
            ->method('getIsVirtual')
            ->willReturn(false);

        $paymentMock = $this->getMockBuilder('\Magento\Quote\Model\Quote\Payment')
            ->disableOriginalConstructor()
            ->getMock();
        $paymentMock->expects($this->once())
            ->method('setMethod')
            ->with(PayPal::METHOD_CODE);

        $this->quoteMock->expects($this->any())
            ->method('getPayment')
            ->willReturn($paymentMock);

        foreach ($expectedShipping as $methodName => $value) {
            $this->shippingAddressMock->expects($this->once())
                ->method($methodName)
                ->with($value)
                ->willReturnSelf();
        }
        foreach ($expectedBilling as $methodName => $value) {
            $this->billingAddressMock->expects($this->once())
                ->method($methodName)
                ->with($value)
                ->willReturnSelf();
        }
        $index = 1;
        foreach ($expectedPaymentAdditionalInfo as $key => $value) {
            $paymentMock->expects($this->at($index))
                ->method('setAdditionalInformation')
                ->with($key, $value);
            $index++;
        }

        $this->quoteMock->expects($this->once())
            ->method('collectTotals');
        $this->quoteRepositoryMock->expects($this->once())
            ->method('save')
            ->with($this->quoteMock);

        $this->model->initializeQuoteForReview($paymentMethodNonce, $details);
    }
開發者ID:razbakov,項目名稱:magento2,代碼行數:54,代碼來源:CheckoutTest.php

示例14: testGetShippingDataObject

 /**
  * @param array $addressData
  * @param bool $useBaseCurrency
  * @param string $shippingTaxClass
  * @param bool $shippingPriceInclTax
  * @dataProvider getShippingDataObjectDataProvider
  */
 public function testGetShippingDataObject(array $addressData, $useBaseCurrency, $shippingTaxClass, $shippingPriceInclTax)
 {
     $baseShippingAmount = $addressData['base_shipping_amount'];
     $shippingAmount = $addressData['shipping_amount'];
     $this->taxConfig->expects($this->any())->method('getShippingTaxClass')->with($this->store)->will($this->returnValue($shippingTaxClass));
     $this->taxConfig->expects($this->any())->method('shippingPriceIncludesTax')->with($this->store)->will($this->returnValue($shippingPriceInclTax));
     $this->address->expects($this->atLeastOnce())->method('getShippingDiscountAmount')->willReturn($shippingAmount);
     if ($shippingAmount) {
         if ($useBaseCurrency && $shippingAmount != 0) {
             $this->address->expects($this->once())->method('getBaseShippingDiscountAmount')->willReturn($baseShippingAmount);
             $expectedDiscountAmount = $baseShippingAmount;
         } else {
             $this->address->expects($this->never())->method('getBaseShippingDiscountAmount');
             $expectedDiscountAmount = $shippingAmount;
         }
     }
     foreach ($addressData as $key => $value) {
         $this->address->setData($key, $value);
     }
     $this->assertEquals($this->quoteDetailsItemDataObject, $this->commonTaxCollector->getShippingDataObject($this->address, $useBaseCurrency));
     if ($shippingAmount) {
         $this->assertEquals($expectedDiscountAmount, $this->quoteDetailsItemDataObject->getDiscountAmount());
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:31,代碼來源:CommonTaxCollectorTest.php

示例15: testEstimateByExtendedAddress

 /**
  * @covers \Magento\Quote\Model\ShippingMethodManagement::estimateByExtendedAddress
  */
 public function testEstimateByExtendedAddress()
 {
     $cartId = 1;
     $addressData = ['region' => 'California', 'region_id' => 23, 'country_id' => 1, 'postcode' => 90200];
     $currencyCode = 'UAH';
     $address = $this->getMockBuilder(Address::class)->disableOriginalConstructor()->setMethods(['getData'])->getMock();
     $this->quoteRepository->expects(static::once())->method('getActive')->with($cartId)->willReturn($this->quote);
     $this->quote->expects(static::once())->method('isVirtual')->willReturn(false);
     $this->quote->expects(static::once())->method('getItemsCount')->willReturn(1);
     $address->expects(static::once())->method('getData')->willReturn($addressData);
     $this->quote->expects(static::once())->method('getShippingAddress')->willReturn($this->shippingAddress);
     $this->shippingAddress->expects(static::once())->method('addData')->with($addressData)->willReturnSelf();
     $this->shippingAddress->expects(static::once())->method('setCollectShippingRates')->with(true)->willReturnSelf();
     $this->totalsCollector->expects(static::once())->method('collectAddressTotals')->with($this->quote, $this->shippingAddress)->willReturnSelf();
     $rate = $this->getMockBuilder(Rate::class)->disableOriginalConstructor()->setMethods([])->getMock();
     $methodObject = $this->getMockForAbstractClass(ShippingMethodInterface::class);
     $expectedRates = [$methodObject];
     $this->shippingAddress->expects(static::once())->method('getGroupedAllShippingRates')->willReturn([[$rate]]);
     $this->quote->expects(static::once())->method('getQuoteCurrencyCode')->willReturn($currencyCode);
     $this->converter->expects(static::once())->method('modelToDataObject')->with($rate, $currencyCode)->willReturn($methodObject);
     $carriersRates = $this->model->estimateByExtendedAddress($cartId, $address);
     static::assertEquals($expectedRates, $carriersRates);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:26,代碼來源:ShippingMethodManagementTest.php


注:本文中的Magento\Quote\Model\Quote\Address::expects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。