• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Api\GroupManagementInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Customer\Api\GroupManagementInterface的典型用法代码示例。如果您正苦于以下问题:PHP GroupManagementInterface类的具体用法?PHP GroupManagementInterface怎么用?PHP GroupManagementInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了GroupManagementInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)->getMockForAbstractClass();
     $this->groupRepositoryMock = $this->getMockBuilder(GroupRepositoryInterface::class)->getMockForAbstractClass();
     $this->groupManagementMock = $this->getMockBuilder(GroupManagementInterface::class)->getMockForAbstractClass();
     $this->searchCriteriaBuilderMock = $this->getMockBuilder(SearchCriteriaBuilder::class)->disableOriginalConstructor()->getMock();
     $this->moduleManagerMock = $this->getMockBuilder(ModuleManager::class)->disableOriginalConstructor()->getMock();
     $this->directoryHelperMock = $this->getMockBuilder(DirectoryHelper::class)->disableOriginalConstructor()->getMock();
     $this->productResourceMock = $this->getMockBuilder(ProductResource::class)->disableOriginalConstructor()->getMock();
     $this->attributeMock = $this->getMockBuilder(Attribute::class)->disableOriginalConstructor()->getMock();
     $this->customerGroupMock = $this->getMockBuilder(CustomerGroupInterface::class)->getMockForAbstractClass();
     $this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup')->willReturn($this->customerGroupMock);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:AdvancedPricingTest.php


示例2: setUp

 protected function setUp()
 {
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->product = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Product');
     $this->tpFactory = $this->getMockForAbstractClass('Magento\\Catalog\\Api\\Data\\ProductTierPriceInterfaceFactory', [], '', false, true, true, ['create']);
     $this->websiteMock = $this->getMock('Magento\\Store\\Model\\Website', ['getId'], [], '', false);
     $storeMangerMock = $this->getMockForAbstractClass('Magento\\Store\\Model\\StoreManagerInterface', [], '', false, true, true, ['getWebsite']);
     $storeMangerMock->expects($this->any())->method('getWebsite')->will($this->returnValue($this->websiteMock));
     $this->scopeConfigMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\Config\\ScopeConfigInterface', [], '', false, true, true, ['getValue']);
     $group = $this->getMock('\\Magento\\Customer\\Model\\Data\\Group', [], [], '', false);
     $group->expects($this->any())->method('getId')->willReturn(GroupManagement::CUST_GROUP_ALL);
     $this->groupManagementMock = $this->getMock('Magento\\Customer\\Api\\GroupManagementInterface', [], [], '', false);
     $this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup')->will($this->returnValue($group));
     $this->model = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Product\\Type\\Price', ['tierPriceFactory' => $this->tpFactory, 'config' => $this->scopeConfigMock, 'storeManager' => $storeMangerMock, 'groupManagement' => $this->groupManagementMock]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:PriceTest.php


示例3: testGetSetCustomerGroupId

 public function testGetSetCustomerGroupId()
 {
     $this->assertEquals($this->groupManagement->getNotLoggedInGroup()->getId(), $this->_model->getCustomerGroupId());
     $customerGroupId = 123;
     $this->_model->setCustomerGroupId($customerGroupId);
     $this->assertEquals($customerGroupId, $this->_model->getCustomerGroupId());
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:7,代码来源:PriceTest.php


示例4: dispatch

 /**
  * Handle customer VAT number if needed on collect_totals_before event of quote address
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function dispatch(\Magento\Framework\Event\Observer $observer)
 {
     /** @var \Magento\Quote\Model\Quote\Address $quoteAddress */
     $quoteAddress = $observer->getQuoteAddress();
     /** @var \Magento\Quote\Model\Quote $quote */
     $quote = $quoteAddress->getQuote();
     $customer = $quote->getCustomer();
     $storeId = $customer->getStoreId();
     if ($customer->getCustomAttribute('disable_auto_group_change') && $customer->getCustomAttribute('disable_auto_group_change')->getValue() || false == $this->vatValidator->isEnabled($quoteAddress, $storeId)) {
         return;
     }
     $customerCountryCode = $quoteAddress->getCountryId();
     $customerVatNumber = $quoteAddress->getVatId();
     $groupId = null;
     if (empty($customerVatNumber) || false == $this->customerVat->isCountryInEU($customerCountryCode)) {
         $groupId = $customer->getId() ? $this->groupManagement->getDefaultGroup($storeId)->getId() : $this->groupManagement->getNotLoggedInGroup()->getId();
     } else {
         // Magento always has to emulate group even if customer uses default billing/shipping address
         $groupId = $this->customerVat->getCustomerGroupIdBasedOnVatNumber($customerCountryCode, $this->vatValidator->validate($quoteAddress, $storeId), $storeId);
     }
     if ($groupId) {
         $quoteAddress->setPrevQuoteCustomerGroupId($quote->getCustomerGroupId());
         $quote->setCustomerGroupId($groupId);
         $customer->setGroupId($groupId);
         $quote->setCustomer($customer);
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:33,代码来源:CollectTotals.php


示例5: execute

 /**
  * Handle customer VAT number if needed on collect_totals_before event of quote address
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     /** @var \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment */
     $shippingAssignment = $observer->getShippingAssignment();
     /** @var \Magento\Quote\Model\Quote $quote */
     $quote = $observer->getQuote();
     /** @var \Magento\Quote\Model\Quote\Address $address */
     $address = $shippingAssignment->getShipping()->getAddress();
     $customer = $quote->getCustomer();
     $storeId = $customer->getStoreId();
     if ($customer->getDisableAutoGroupChange() || false == $this->vatValidator->isEnabled($address, $storeId)) {
         return;
     }
     $customerCountryCode = $address->getCountryId();
     $customerVatNumber = $address->getVatId();
     $groupId = null;
     if (empty($customerVatNumber) || false == $this->customerVat->isCountryInEU($customerCountryCode)) {
         $groupId = $customer->getId() ? $this->groupManagement->getDefaultGroup($storeId)->getId() : $this->groupManagement->getNotLoggedInGroup()->getId();
     } else {
         // Magento always has to emulate group even if customer uses default billing/shipping address
         $groupId = $this->customerVat->getCustomerGroupIdBasedOnVatNumber($customerCountryCode, $this->vatValidator->validate($address, $storeId), $storeId);
     }
     if ($groupId) {
         $address->setPrevQuoteCustomerGroupId($quote->getCustomerGroupId());
         $quote->setCustomerGroupId($groupId);
         $customer->setGroupId($groupId);
         $quote->setCustomer($customer);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:35,代码来源:CollectTotalsObserver.php


示例6: getCustomerGroupId

 /**
  * Getter for customer group id, return default group if not set
  *
  * @return int
  */
 public function getCustomerGroupId()
 {
     if ($this->customerGroupId === null) {
         return $this->groupManagement->getAllCustomersGroup()->getId();
     }
     return parent::getCustomerGroupId();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:12,代码来源:Item.php


示例7: toOptionArray

 /**
  * Retrieve customer groups as array
  *
  * @return array
  */
 public function toOptionArray()
 {
     if (!$this->_options) {
         $groups = $this->_groupManagement->getLoggedInGroups();
         $this->_options = $this->_converter->toOptionArray($groups, 'id', 'code');
     }
     return $this->_options;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Multiselect.php


示例8: toOptionArray

 /**
  * @return array
  */
 public function toOptionArray()
 {
     if (!$this->_options) {
         $groups = $this->_groupManagement->getLoggedInGroups();
         $this->_options = $this->_converter->toOptionArray($groups, 'id', 'code');
         array_unshift($this->_options, ['value' => '', 'label' => __('-- Please Select --')]);
     }
     return $this->_options;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:Group.php


示例9: testAddTierPriceData

 /**
  * @magentoDataFixture Magento/Catalog/Model/Resource/_files/product_simple.php
  */
 public function testAddTierPriceData()
 {
     $this->_collection->setFlag('tier_price_added', false);
     $this->_collection->addIdFilter(2);
     $this->assertInstanceOf('\\Magento\\Catalog\\Model\\Resource\\Product\\Collection', $this->_collection->addTierPriceData());
     $tierPrice = $this->_collection->getFirstItem()->getDataByKey('tier_price');
     $this->assertEquals($this->_groupManagement->getNotLoggedInGroup()->getId(), current($tierPrice)['cust_group']);
     $this->assertEquals($this->_groupManagement->getAllCustomersGroup()->getId(), next($tierPrice)['cust_group']);
     $this->assertTrue($this->_collection->getFlag('tier_price_added'));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:CollectionTest.php


示例10: testDeleteButtonNotExistInDefaultGroup

 /**
  * Verify that the Delete button does not exist for the default group.
  * @magentoAppIsolation enabled
  */
 public function testDeleteButtonNotExistInDefaultGroup()
 {
     $groupId = $this->groupManagement->getDefaultGroup(0)->getId();
     $this->registry->register(RegistryConstants::CURRENT_GROUP_ID, $groupId);
     $this->getRequest()->setParam('id', $groupId);
     /** @var $block Edit */
     $block = $this->layout->createBlock('Magento\\Customer\\Block\\Adminhtml\\Group\\Edit', 'block');
     $buttonsHtml = $block->getButtonsHtml();
     $this->assertNotContains('delete', $buttonsHtml);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:EditTest.php


示例11: _afterDelete

 /**
  * Method set default group id to the customers collection
  *
  * @param \Magento\Framework\Model\AbstractModel $group
  * @return $this
  */
 protected function _afterDelete(\Magento\Framework\Model\AbstractModel $group)
 {
     $customerCollection = $this->_createCustomersCollection()->addAttributeToFilter('group_id', $group->getId())->load();
     foreach ($customerCollection as $customer) {
         /** @var $customer \Magento\Customer\Model\Customer */
         $customer->load($customer->getId());
         $defaultGroupId = $this->_groupManagement->getDefaultGroup($customer->getStoreId())->getId();
         $customer->setGroupId($defaultGroupId);
         $customer->save();
     }
     return parent::_afterDelete($group);
 }
开发者ID:shazal,项目名称:magento2,代码行数:18,代码来源:Group.php


示例12: _construct

 /**
  * Update Save and Delete buttons. Remove Delete button if group can't be deleted.
  *
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $this->_objectId = 'id';
     $this->_controller = 'adminhtml_group';
     $this->_blockGroup = 'Magento_Customer';
     $this->buttonList->update('save', 'label', __('Save Customer Group'));
     $this->buttonList->update('delete', 'label', __('Delete Customer Group'));
     $groupId = $this->coreRegistry->registry(RegistryConstants::CURRENT_GROUP_ID);
     if (!$groupId || $this->groupManagement->isReadonly($groupId)) {
         $this->buttonList->remove('delete');
     }
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:18,代码来源:Edit.php


示例13: testGetQuoteWithoutQuoteId

 /**
  * Run test getQuote method
  *
  * @return void
  */
 public function testGetQuoteWithoutQuoteId()
 {
     $quoteId = 22;
     $storeId = 10;
     $customerId = 66;
     $customerGroupId = 77;
     $this->quote->expects($this->any())->method('getQuoteId')->will($this->returnValue(null));
     $this->quote->expects($this->any())->method('setQuoteId')->with($quoteId);
     $cartInterfaceMock = $this->getMock('\\Magento\\Quote\\Api\\Data\\CartInterface', ['getId', 'setId', 'getCreatedAt', 'setCreatedAt', 'getUpdatedAt', 'setUpdatedAt', 'getConvertedAt', 'setConvertedAt', 'getIsActive', 'setIsActive', 'getIsVirtual', 'getItems', 'setItems', 'getItemsCount', 'setItemsCount', 'getItemsQty', 'setItemsQty', 'getCustomer', 'setCustomer', 'getBillingAddress', 'setBillingAddress', 'getReservedOrderId', 'setReservedOrderId', 'getOrigOrderId', 'setOrigOrderId', 'getCurrency', 'setCurrency', 'getCustomerIsGuest', 'setCustomerIsGuest', 'getCustomerNote', 'setCustomerNote', 'getCustomerNoteNotify', 'setCustomerNoteNotify', 'getCustomerTaxClassId', 'setCustomerTaxClassId', 'getStoreId', 'setStoreId', 'getExtensionAttributes', 'setExtensionAttributes', 'setIgnoreOldQty', 'setIsSuperMode', 'setCustomerGroupId']);
     $this->quoteFactoryMock->expects($this->once())->method('create')->willReturn($cartInterfaceMock);
     $this->quote->expects($this->any())->method('getStoreId')->will($this->returnValue($storeId));
     $this->quote->expects($this->any())->method('getCustomerId')->will($this->returnValue($customerId));
     $cartInterfaceMock->expects($this->atLeastOnce())->method('getId')->willReturn($quoteId);
     $defaultGroup = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\GroupInterface')->getMock();
     $defaultGroup->expects($this->any())->method('getId')->will($this->returnValue($customerGroupId));
     $this->groupManagementMock->expects($this->any())->method('getDefaultGroup')->will($this->returnValue($defaultGroup));
     $dataCustomerMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->disableOriginalConstructor()->getMock();
     $this->customerRepositoryMock->expects($this->once())->method('getById')->with($customerId)->willReturn($dataCustomerMock);
     $quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', ['setStoreId', 'setCustomerGroupId', 'setIsActive', 'assignCustomer', 'setIgnoreOldQty', 'setIsSuperMode', '__wakeup'], [], '', false);
     $this->quoteRepositoryMock->expects($this->once())->method('get')->willReturn($quoteMock);
     $cartInterfaceMock->expects($this->once())->method('setCustomerGroupId')->with($customerGroupId)->will($this->returnSelf());
     $quoteMock->expects($this->once())->method('assignCustomer')->with($dataCustomerMock);
     $quoteMock->expects($this->once())->method('setIgnoreOldQty')->with(true);
     $quoteMock->expects($this->once())->method('setIsSuperMode')->with(true);
     $this->assertEquals($quoteMock, $this->quote->getQuote());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:31,代码来源:QuoteTest.php


示例14: convertAttribute

 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Product $product
  * @param Entry $entry
  * @return Entry
  */
 public function convertAttribute($product, $entry)
 {
     $product->setWebsiteId($this->_storeManager->getStore($product->getStoreId())->getWebsiteId());
     $defaultCustomerGroup = $this->groupManagement->getDefaultGroup($product->getStoreId());
     $product->setCustomerGroupId($defaultCustomerGroup->getId());
     /** @var \Magento\Store\Model\Store $store */
     $store = $this->_storeManager->getStore($product->getStoreId());
     $isSalePriceAllowed = $this->_config->getTargetCountry($product->getStoreId()) == 'US';
     // get tax settings
     $priceDisplayType = $this->_taxData->getPriceDisplayType($product->getStoreId());
     $inclTax = $priceDisplayType == Config::DISPLAY_TYPE_INCLUDING_TAX;
     $finalPrice = $this->_getFinalPrice($product, $store, $inclTax, $isSalePriceAllowed);
     // calculate price attribute value
     $price = $this->_getPrice($product, $store, $priceDisplayType, $inclTax, $isSalePriceAllowed);
     if ($isSalePriceAllowed) {
         // set sale_price and effective dates for it
         if ($price && $price - $finalPrice > 0.0001) {
             $this->_setAttributePrice($entry, $product, $price);
             $this->_setAttributePrice($entry, $product, $finalPrice, 'sale_price');
             $this->_setEffectiveDate($product, $entry);
         } else {
             $this->_setAttributePrice($entry, $product, $finalPrice);
             $entry->removeContentAttribute('sale_price_effective_date');
             $entry->removeContentAttribute('sale_price');
         }
         // calculate taxes
         $tax = $this->getGroupAttributeTax();
         if (!$inclTax && !is_null($tax)) {
             $tax->convertAttribute($product, $entry);
         }
     } else {
         $this->_setAttributePrice($entry, $product, $price);
     }
     return $entry;
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:42,代码来源:Price.php


示例15: extract

 /**
  * @param string $formCode
  * @param RequestInterface $request
  * @return \Magento\Customer\Api\Data\CustomerInterface
  */
 public function extract($formCode, RequestInterface $request)
 {
     $customerForm = $this->formFactory->create('customer', $formCode);
     $customerData = $customerForm->extractData($request);
     $allowedAttributes = $customerForm->getAllowedAttributes();
     $isGroupIdEmpty = isset($allowedAttributes['group_id']);
     $customerDataObject = $this->customerFactory->create();
     $this->dataObjectHelper->populateWithArray($customerDataObject, $customerData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $store = $this->storeManager->getStore();
     if ($isGroupIdEmpty) {
         $customerDataObject->setGroupId($this->customerGroupManagement->getDefaultGroup($store->getId())->getId());
     }
     $customerDataObject->setWebsiteId($store->getWebsiteId());
     $customerDataObject->setStoreId($store->getId());
     return $customerDataObject;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:21,代码来源:CustomerExtractor.php


示例16: getQuote

 /**
  * Retrieve quote model object
  *
  * @return \Magento\Quote\Model\Quote
  */
 public function getQuote()
 {
     if ($this->_quote === null) {
         $this->_quote = $this->quoteFactory->create();
         if ($this->getStoreId()) {
             if (!$this->getQuoteId()) {
                 $this->_quote->setCustomerGroupId($this->groupManagement->getDefaultGroup()->getId());
                 $this->_quote->setIsActive(false);
                 $this->_quote->setStoreId($this->getStoreId());
                 $this->quoteRepository->save($this->_quote);
                 $this->setQuoteId($this->_quote->getId());
                 $this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);
             } else {
                 $this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);
                 $this->_quote->setStoreId($this->getStoreId());
             }
             if ($this->getCustomerId() && $this->getCustomerId() != $this->_quote->getCustomerId()) {
                 $customer = $this->customerRepository->getById($this->getCustomerId());
                 $this->_quote->assignCustomer($customer);
                 $this->quoteRepository->save($this->_quote);
             }
         }
         $this->_quote->setIgnoreOldQty(true);
         $this->_quote->setIsSuperMode(true);
     }
     return $this->_quote;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:32,代码来源:Quote.php


示例17: afterAddressSave

 /**
  * Address after save event handler
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function afterAddressSave($observer)
 {
     /** @var $customerAddress Address */
     $customerAddress = $observer->getCustomerAddress();
     $customer = $customerAddress->getCustomer();
     if (!$this->_customerAddress->isVatValidationEnabled($customer->getStore()) || $this->_coreRegistry->registry(self::VIV_PROCESSED_FLAG) || !$this->_canProcessAddress($customerAddress)) {
         return;
     }
     try {
         $this->_coreRegistry->register(self::VIV_PROCESSED_FLAG, true);
         if ($customerAddress->getVatId() == '' || !$this->_customerVat->isCountryInEU($customerAddress->getCountry())) {
             $defaultGroupId = $this->_groupManagement->getDefaultGroup($customer->getStore())->getId();
             if (!$customer->getDisableAutoGroupChange() && $customer->getGroupId() != $defaultGroupId) {
                 $customer->setGroupId($defaultGroupId);
                 $customer->save();
             }
         } else {
             $result = $this->_customerVat->checkVatNumber($customerAddress->getCountryId(), $customerAddress->getVatId());
             $newGroupId = $this->_customerVat->getCustomerGroupIdBasedOnVatNumber($customerAddress->getCountryId(), $result, $customer->getStore());
             if (!$customer->getDisableAutoGroupChange() && $customer->getGroupId() != $newGroupId) {
                 $customer->setGroupId($newGroupId);
                 $customer->save();
             }
             $customerAddress->setVatValidationResult($result);
         }
     } catch (\Exception $e) {
         $this->_coreRegistry->register(self::VIV_PROCESSED_FLAG, false, true);
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:36,代码来源:Observer.php


示例18: assertDefaultGroupMatches

 /**
  * @param $testGroup
  * @param $storeId
  */
 private function assertDefaultGroupMatches($testGroup, $storeId)
 {
     $group = $this->groupManagement->getDefaultGroup($storeId);
     $this->assertEquals($testGroup['id'], $group->getId());
     $this->assertEquals($testGroup['code'], $group->getCode());
     $this->assertEquals($testGroup['tax_class_id'], $group->getTaxClassId());
     $this->assertEquals($testGroup['tax_class_name'], $group->getTaxClassName());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:GroupManagementTest.php


示例19: _logout

 /**
  * Logout without dispatching event
  *
  * @return $this
  */
 protected function _logout()
 {
     $this->_customer = null;
     $this->_customerModel = null;
     $this->setCustomerId(null);
     $this->setCustomerGroupId($this->groupManagement->getNotLoggedInGroup()->getId());
     $this->destroy(['clear_storage' => false]);
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:Session.php


示例20: testExtract

 public function testExtract()
 {
     $customerData = ['firstname' => 'firstname', 'lastname' => 'firstname', 'email' => 'email.example.com'];
     $this->formFactory->expects($this->once())->method('create')->with('customer', 'form-code')->willReturn($this->customerForm);
     $this->customerForm->expects($this->once())->method('extractData')->with($this->request)->willReturn($customerData);
     $this->customerForm->expects($this->once())->method('getAllowedAttributes')->willReturn(['group_id' => 'attribute object']);
     $this->customerFactory->expects($this->once())->method('create')->willReturn($this->customerData);
     $this->dataObjectHelper->expects($this->once())->method('populateWithArray')->with($this->customerData, $customerData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface')->willReturn($this->customerData);
     $this->storeManager->expects($this->once())->method('getStore')->willReturn($this->store);
     $this->store->expects($this->exactly(2))->method('getId')->willReturn(1);
     $this->customerGroupManagement->expects($this->once())->method('getDefaultGroup')->with(1)->willReturn($this->customerGroup);
     $this->customerGroup->expects($this->once())->method('getId')->willReturn(1);
     $this->customerData->expects($this->once())->method('setGroupId')->with(1);
     $this->store->expects($this->once())->method('getWebsiteId')->willReturn(1);
     $this->customerData->expects($this->once())->method('setWebsiteId')->with(1);
     $this->customerData->expects($this->once())->method('setStoreId')->with(1);
     $this->assertSame($this->customerData, $this->customerExtractor->extract('form-code', $this->request));
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:18,代码来源:CustomerExtractorTest.php



注:本文中的Magento\Customer\Api\GroupManagementInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Api\GroupRepositoryInterface类代码示例发布时间:2022-05-23
下一篇:
PHP Api\CustomerRepositoryInterface类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap