本文整理汇总了PHP中Magento\Customer\Api\Data\CustomerInterface类的典型用法代码示例。如果您正苦于以下问题:PHP CustomerInterface类的具体用法?PHP CustomerInterface怎么用?PHP CustomerInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CustomerInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param CustomerInterface $entity
* @param array $arguments
* @return CustomerInterface
* @throws \Exception
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function execute($entity, $arguments = [])
{
$extensionAttribute = $entity->getExtensionAttributes()->getExtensionAttribute();
$extensionAttribute->setCustomerId($entity->getId());
$extensionAttribute = $this->entityManager->save($extensionAttribute);
$entity->getExtensionAttributes()->setExtensionAttribute($extensionAttribute);
return $entity;
}
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:SaveHandler.php
示例2: setUp
public function setUp()
{
if (!function_exists('libxml_set_external_entity_loader')) {
$this->markTestSkipped('Skipped on HHVM. Will be fixed in MAGETWO-45033');
}
$this->customer = $this->getMockForAbstractClass('Magento\\Customer\\Api\\Data\\CustomerInterface', [], '', false, true, true);
$this->customer->expects($this->once())->method('getWebsiteId')->willReturn(2);
$this->customerDataFactory = $this->getMock('Magento\\Customer\\Api\\Data\\CustomerInterfaceFactory', ['create'], [], '', false);
$this->customerDataFactory->expects($this->once())->method('create')->willReturn($this->customer);
$this->form = $this->getMock('Magento\\Customer\\Model\\Metadata\\Form', [], [], '', false);
$this->request = $this->getMockForAbstractClass('Magento\\Framework\\App\\RequestInterface', [], '', false, true, true, ['getPost']);
$this->response = $this->getMockForAbstractClass('Magento\\Framework\\App\\ResponseInterface', [], '', false);
$this->formFactory = $this->getMock('Magento\\Customer\\Model\\Metadata\\FormFactory', ['create'], [], '', false);
$this->formFactory->expects($this->atLeastOnce())->method('create')->willReturn($this->form);
$this->extensibleDataObjectConverter = $this->getMock('Magento\\Framework\\Api\\ExtensibleDataObjectConverter', [], [], '', false);
$this->dataObjectHelper = $this->getMock('Magento\\Framework\\Api\\DataObjectHelper', [], [], '', false);
$this->dataObjectHelper->expects($this->once())->method('populateWithArray');
$this->customerAccountManagement = $this->getMockForAbstractClass('Magento\\Customer\\Api\\AccountManagementInterface', [], '', false, true, true);
$this->resultJson = $this->getMock('Magento\\Framework\\Controller\\Result\\Json', [], [], '', false);
$this->resultJson->expects($this->once())->method('setData');
$this->resultJsonFactory = $this->getMock('Magento\\Framework\\Controller\\Result\\JsonFactory', ['create'], [], '', false);
$this->resultJsonFactory->expects($this->once())->method('create')->willReturn($this->resultJson);
$objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->controller = $objectHelper->getObject('Magento\\Customer\\Controller\\Adminhtml\\Index\\Validate', ['request' => $this->request, 'response' => $this->response, 'customerDataFactory' => $this->customerDataFactory, 'formFactory' => $this->formFactory, 'extensibleDataObjectConverter' => $this->extensibleDataObjectConverter, 'customerAccountManagement' => $this->customerAccountManagement, 'resultJsonFactory' => $this->resultJsonFactory, 'dataObjectHelper' => $this->dataObjectHelper]);
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:25,代码来源:ValidateTest.php
示例3: save
/**
* @param CustomerInterface $customer
* @return \Openpay\Client\Type\OpenpayCustomerType
* @throws LocalizedException
*/
public function save(CustomerInterface $customer)
{
$params = ['name' => $customer->getFirstname(), 'last_name' => $customer->getLastname(), 'email' => $customer->getEmail(), 'requires_account' => self::CUSTOMER_REQUIRES_ACCOUNT, 'external_id' => $customer->getId()];
try {
$openpayCustomer = $this->customerAdapter->store($params);
} catch (OpenpayException $e) {
throw new LocalizedException(__($e->getDescription()), $e);
}
return $openpayCustomer;
}
开发者ID:degaray,项目名称:openpay-magento2-module,代码行数:15,代码来源:OpenpayCustomerRepository.php
示例4: execute
/**
* @param CustomerInterface $entity
* @param array $arguments
* @return CustomerInterface
* @throws \Exception
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function execute($entity, $arguments = [])
{
$newAddresses = [];
foreach ($entity->getAddresses() as $address) {
$address->setCustomerId($entity->getId());
$newAddresses[] = $this->entityManager->save($address);
}
$entity->setAddresses($newAddresses);
return $entity;
}
开发者ID:Doability,项目名称:magento2dev,代码行数:17,代码来源:SaveHandler.php
示例5: getBusCodeForCustomerGroup
/** @inheritdoc */
public function getBusCodeForCustomerGroup(\Magento\Customer\Api\Data\CustomerInterface $customer)
{
$result = self::B_CUST_GROUP_RETAIL;
$groupId = $customer->getGroupId();
if ($groupId == self::M_CUST_GROUP_DISTRIBUTOR) {
$result = self::B_CUST_GROUP_DISTRIBUTOR;
} elseif ($groupId == self::M_CUST_GROUP_WHOLESALE) {
$result = self::B_CUST_GROUP_WHOLESALE;
}
return $result;
}
开发者ID:praxigento,项目名称:mobi_app_generic_mage2,代码行数:12,代码来源:BusinessCodesManager.php
示例6: execute
/**
* @param CustomerInterface $entity
* @param array $arguments
* @return CustomerInterface
* @throws \Exception
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function execute($entity, $arguments = [])
{
$metadata = $this->metadataPool->getMetadata(ExtensionAttributeInterface::class);
$connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
$id = $connection->fetchOne($connection->select()->from($metadata->getEntityTable(), [$metadata->getIdentifierField()])->where('customer_id = ?', $entity->getId())->limit(1));
$extensionAttribute = $this->extensionAttributeFactory->create();
$extensionAttribute = $this->entityManager->load($extensionAttribute, $id);
$customerExtension = $this->customerExtensionFactory->create(['data' => ['extension_attribute' => $extensionAttribute]]);
$entity->setExtensionAttributes($customerExtension);
return $entity;
}
开发者ID:Doability,项目名称:magento2dev,代码行数:18,代码来源:ReadHandler.php
示例7: testEditPostActionWithoutErrors
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testEditPostActionWithoutErrors()
{
$customerId = 24;
$address = $this->getMockForAbstractClass('Magento\\Customer\\Api\\Data\\AddressInterface', [], '', false);
$loadedCustomer = $this->getMockForAbstractClass('Magento\\Customer\\Api\\Data\\CustomerInterface', [], 'loadedCustomer', false);
$loadedCustomer->expects($this->once())->method('getAddresses')->willReturn([$address, $address]);
$this->resultRedirectFactory->expects($this->once())->method('create')->willReturn($this->redirectResultMock);
$this->formKeyValidator->expects($this->once())->method('validate')->willReturn(true);
$this->request->expects($this->once())->method('isPost')->willReturn(true);
$this->customerSession->expects($this->once())->method('getCustomerId')->willReturn($customerId);
$this->customerExtractor->expects($this->once())->method('extract')->willReturn($this->customer);
$this->customer->expects($this->once())->method('setId')->with($customerId);
$this->customer->expects($this->once())->method('getAddresses')->willReturn(null);
$this->customerRepository->expects($this->exactly(2))->method('getById')->with($customerId)->willReturn($loadedCustomer);
$this->customer->expects($this->once())->method('setAddresses')->with([$address, $address]);
$this->request->expects($this->once())->method('getParam')->with('change_password')->willReturn(true);
$this->request->expects($this->at(2))->method('getPost')->with('current_password', null)->willReturn(123);
$this->request->expects($this->at(3))->method('getPost')->with('password', null)->willReturn(321);
$this->request->expects($this->at(4))->method('getPost')->with('password_confirmation', null)->willReturn(321);
$this->customerAccountManagement->expects($this->once())->method('changePassword');
$this->customerRepository->expects($this->once())->method('save');
$messageCollection = $this->getMock('Magento\\Framework\\Message\\Collection', [], [], '', false);
$messageCollection->expects($this->once())->method('getCount')->willReturn(0);
$this->messageManager->expects($this->once())->method('getMessages')->willReturn($messageCollection);
$this->messageManager->expects($this->once())->method('addSuccess')->with('You saved the account information.');
$this->redirectResultMock->expects($this->once())->method('setPath')->with('customer/account')->willReturn('http://test.com/customer/account/edit');
$this->assertSame($this->redirectResultMock, $this->getController()->execute());
}
开发者ID:nja78,项目名称:magento2,代码行数:31,代码来源:EditPostTest.php
示例8: _populateQuoteAddrShipping
public function _populateQuoteAddrShipping(\Magento\Quote\Model\Quote $quote, \Magento\Customer\Api\Data\CustomerInterface $customerDo)
{
/** @var \Magento\Quote\Model\Quote\Address $addr */
$addr = $this->_manObj->create(\Magento\Quote\Model\Quote\Address::class);
$addr->setFirstname($customerDo->getFirstname());
$addr->setLastname($customerDo->getLastname());
$addr->setEmail($customerDo->getEmail());
$addr->setTelephone('23344556');
$addr->setStreet('Liela iela');
$addr->setCity('Riga');
$addr->setRegionId(362);
// Riga region
$addr->setPostcode('1010');
$addr->setCountryId('LV');
$quote->setShippingAddress($addr);
return $quote;
}
开发者ID:praxigento,项目名称:mobi_app_generic_mage2,代码行数:17,代码来源:SaleOrder.php
示例9: 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
示例10: getCustomerName
/**
* Concatenate all customer name parts into full customer name.
*
* @param CustomerInterface $customerData
* @return string
*/
public function getCustomerName(CustomerInterface $customerData)
{
$name = '';
$prefixMetadata = $this->_customerMetadataService->getAttributeMetadata('prefix');
if ($prefixMetadata->isVisible() && $customerData->getPrefix()) {
$name .= $customerData->getPrefix() . ' ';
}
$name .= $customerData->getFirstname();
$middleNameMetadata = $this->_customerMetadataService->getAttributeMetadata('middlename');
if ($middleNameMetadata->isVisible() && $customerData->getMiddlename()) {
$name .= ' ' . $customerData->getMiddlename();
}
$name .= ' ' . $customerData->getLastname();
$suffixMetadata = $this->_customerMetadataService->getAttributeMetadata('suffix');
if ($suffixMetadata->isVisible() && $customerData->getSuffix()) {
$name .= ' ' . $customerData->getSuffix();
}
return $name;
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:25,代码来源:View.php
示例11: createOrUpdateAndLogin
/**
* Create or update user by using data from facebook and login to store
*
* @param GraphUser $facebookUser
* @param AccessToken $accessToken
*
* @return CustomerInterface
*/
private function createOrUpdateAndLogin(GraphUser $facebookUser, AccessToken $accessToken)
{
if (!$this->customer->getId()) {
$this->customer->setEmail($facebookUser->getEmail());
$this->customer->setFirstname($facebookUser->getFirstName());
$this->customer->setLastname($facebookUser->getLastName());
$this->customer->setMiddlename($facebookUser->getMiddleName());
$this->customer->setGender((int) ($facebookUser->getGender() == 'male'));
}
$this->customer->setCustomAttribute('sf_id', $facebookUser->getId());
$this->customer->setCustomAttribute('sf_access_token', serialize($accessToken));
if ($this->customer->getId()) {
$customer = $this->customerRepository->save($this->customer);
} else {
$customer = $this->accountManagement->createAccount($this->customer);
}
$this->login($customer->getId());
return $customer;
}
开发者ID:Viktor-V,项目名称:Facebook-Login,代码行数:27,代码来源:Index.php
示例12: createQuote
/**
* Create a quote object with customer
*
* @param array $quoteData
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
* @return \Magento\Quote\Model\Quote
*/
protected function createQuote($quoteData, $customer)
{
/** @var \Magento\Customer\Api\AddressRepositoryInterface $addressService */
$addressService = $this->objectManager->create('Magento\\Customer\\Api\\AddressRepositoryInterface');
/** @var array $shippingAddressOverride */
$shippingAddressOverride = empty($quoteData['shipping_address']) ? [] : $quoteData['shipping_address'];
/** @var \Magento\Customer\Model\Address $shippingAddress */
$shippingAddress = $this->createCustomerAddress($shippingAddressOverride, $customer->getId());
/** @var \Magento\Quote\Model\Quote\Address $quoteShippingAddress */
$quoteShippingAddress = $this->objectManager->create('Magento\\Quote\\Model\\Quote\\Address');
$quoteShippingAddress->importCustomerAddressData($addressService->getById($shippingAddress->getId()));
/** @var array $billingAddressOverride */
$billingAddressOverride = empty($quoteData['billing_address']) ? [] : $quoteData['billing_address'];
/** @var \Magento\Customer\Model\Address $billingAddress */
$billingAddress = $this->createCustomerAddress($billingAddressOverride, $customer->getId());
/** @var \Magento\Quote\Model\Quote\Address $quoteBillingAddress */
$quoteBillingAddress = $this->objectManager->create('Magento\\Quote\\Model\\Quote\\Address');
$quoteBillingAddress->importCustomerAddressData($addressService->getById($billingAddress->getId()));
/** @var \Magento\Quote\Model\Quote $quote */
$quote = $this->objectManager->create('Magento\\Quote\\Model\\Quote');
$quote->setStoreId(1)->setIsActive(true)->setIsMultiShipping(false)->assignCustomerWithAddressChange($customer, $quoteBillingAddress, $quoteShippingAddress)->setCheckoutMethod('register')->setPasswordHash($this->accountManagement->getPasswordHash(static::CUSTOMER_PASSWORD));
return $quote;
}
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:30,代码来源:SetupUtil.php
示例13: processChangeEmailRequest
/**
* Process change email request
*
* @param \Magento\Customer\Api\Data\CustomerInterface $currentCustomerDataObject
* @return void
* @throws InvalidEmailOrPasswordException
* @throws UserLockedException
*/
private function processChangeEmailRequest(\Magento\Customer\Api\Data\CustomerInterface $currentCustomerDataObject)
{
if ($this->getRequest()->getParam('change_email')) {
// authenticate user for changing email
try {
$this->getAuthentication()->authenticate($currentCustomerDataObject->getId(), $this->getRequest()->getPost('current_password'));
} catch (InvalidEmailOrPasswordException $e) {
throw new InvalidEmailOrPasswordException(__('The password doesn\'t match this account.'));
}
}
}
开发者ID:Doability,项目名称:magento2dev,代码行数:19,代码来源:EditPost.php
示例14: getOpenpayCustomerId
/**
* @param CustomerInterface $customerDataModel
* @return string
*/
protected function getOpenpayCustomerId(CustomerInterface $customerDataModel)
{
$openpayCustomer = $customerDataModel->getCustomAttribute(UpgradeData::OPENPAY_CUSTOMER_ID_CUSTOM_ATTRIBUTE);
$openpayCustomerId = is_null($openpayCustomer) ? null : $openpayCustomer->getValue();
return $openpayCustomerId;
}
开发者ID:degaray,项目名称:openpay-magento2-module,代码行数:10,代码来源:SaveCustomerCards.php
示例15: getFullCustomerObject
/**
* Create an object with data merged from Customer and CustomerSecure
*
* @param CustomerInterface $customer
* @return Data\CustomerSecure
*/
protected function getFullCustomerObject($customer)
{
// No need to flatten the custom attributes or nested objects since the only usage is for email templates and
// object passed for events
$mergedCustomerData = $this->customerRegistry->retrieveSecureData($customer->getId());
$customerData = $this->dataProcessor->buildOutputDataArray($customer, '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$mergedCustomerData->addData($customerData);
$mergedCustomerData->setData('name', $this->customerViewHelper->getCustomerName($customer));
return $mergedCustomerData;
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:AccountManagement.php
示例16: _prepareCustomerAddress
/**
* Create customer address and save it in the quote so that it can be used to persist later.
*
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
* @param \Magento\Quote\Model\Quote\Address $quoteCustomerAddress
* @return void
* @throws \InvalidArgumentException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function _prepareCustomerAddress($customer, $quoteCustomerAddress)
{
// Possible that customerId is null for new customers
$quoteCustomerAddress->setCustomerId($customer->getId());
$customerAddress = $quoteCustomerAddress->exportCustomerAddress();
$quoteAddressId = $quoteCustomerAddress->getCustomerAddressId();
$addressType = $quoteCustomerAddress->getAddressType();
if ($quoteAddressId) {
/** Update existing address */
$existingAddressDataObject = $this->addressRepository->getById($quoteAddressId);
/** Update customer address data */
$this->dataObjectHelper->mergeDataObjects(get_class($existingAddressDataObject), $existingAddressDataObject, $customerAddress);
$customerAddress = $existingAddressDataObject;
} elseif ($addressType == \Magento\Quote\Model\Quote\Address::ADDRESS_TYPE_SHIPPING) {
try {
$billingAddressDataObject = $this->accountManagement->getDefaultBillingAddress($customer->getId());
} catch (\Exception $e) {
/** Billing address does not exist. */
}
$isShippingAsBilling = $quoteCustomerAddress->getSameAsBilling();
if (isset($billingAddressDataObject) && $isShippingAsBilling) {
/** Set existing billing address as default shipping */
$customerAddress = $billingAddressDataObject;
$customerAddress->setIsDefaultShipping(true);
}
}
switch ($addressType) {
case \Magento\Quote\Model\Quote\Address::ADDRESS_TYPE_BILLING:
if (is_null($customer->getDefaultBilling())) {
$customerAddress->setIsDefaultBilling(true);
}
break;
case \Magento\Quote\Model\Quote\Address::ADDRESS_TYPE_SHIPPING:
if (is_null($customer->getDefaultShipping())) {
$customerAddress->setIsDefaultShipping(true);
}
break;
default:
throw new \InvalidArgumentException('Customer address type is invalid.');
}
$this->getQuote()->setCustomer($customer);
$this->getQuote()->addCustomerAddress($customerAddress);
}
开发者ID:whoople,项目名称:magento2-testing,代码行数:52,代码来源:Create.php
示例17: setCustomer
/**
* Define customer object
*
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
* @return $this
*/
public function setCustomer(\Magento\Customer\Api\Data\CustomerInterface $customer = null)
{
/* @TODO: Remove the method after all external usages are refactored in MAGETWO-19930 */
$this->_customer = $customer;
$this->setCustomerId($customer->getId());
$origAddresses = $customer->getAddresses();
$customer->setAddresses([]);
$customerDataFlatArray = $this->objectFactory->create($this->extensibleDataObjectConverter->toFlatArray($customer, [], '\\Magento\\Customer\\Api\\Data\\CustomerInterface'));
$customer->setAddresses($origAddresses);
$this->_objectCopyService->copyFieldsetToTarget('customer_account', 'to_quote', $customerDataFlatArray, $this);
return $this;
}
开发者ID:niranjanssiet,项目名称:magento2,代码行数:18,代码来源:Quote.php
示例18: validate
/**
* Validate customer attribute values.
*
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
* @throws InputException
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
private function validate(\Magento\Customer\Api\Data\CustomerInterface $customer)
{
$exception = new InputException();
if (!\Zend_Validate::is(trim($customer->getFirstname()), 'NotEmpty')) {
$exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'firstname']));
}
if (!\Zend_Validate::is(trim($customer->getLastname()), 'NotEmpty')) {
$exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'lastname']));
}
$isEmailAddress = \Zend_Validate::is($customer->getEmail(), 'EmailAddress');
if (!$isEmailAddress) {
$exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'email', 'value' => $customer->getEmail()]));
}
$dob = $this->getAttributeMetadata('dob');
if ($dob !== null && $dob->isRequired() && '' == trim($customer->getDob())) {
$exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'dob']));
}
$taxvat = $this->getAttributeMetadata('taxvat');
if ($taxvat !== null && $taxvat->isRequired() && '' == trim($customer->getTaxvat())) {
$exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'taxvat']));
}
$gender = $this->getAttributeMetadata('gender');
if ($gender !== null && $gender->isRequired() && '' == trim($customer->getGender())) {
$exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'gender']));
}
if ($exception->wasErrorAdded()) {
throw $exception;
}
}
开发者ID:whoople,项目名称:magento2-testing,代码行数:38,代码来源:CustomerRepository.php
示例19: loadByCustomerData
/**
* Load subscriber by customer
*
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
* @return array
*/
public function loadByCustomerData(\Magento\Customer\Api\Data\CustomerInterface $customer)
{
$select = $this->connection->select()->from($this->getMainTable())->where('customer_id=:customer_id');
$result = $this->connection->fetchRow($select, ['customer_id' => $customer->getId()]);
if ($result) {
return $result;
}
$select = $this->connection->select()->from($this->getMainTable())->where('subscriber_email=:subscriber_email');
$result = $this->connection->fetchRow($select, ['subscriber_email' => $customer->getEmail()]);
if ($result) {
return $result;
}
return [];
}
开发者ID:whoople,项目名称:magento2-testing,代码行数:20,代码来源:Subscriber.php
示例20: testGetCustomerDepersonalizeCustomerData
/**
* test getCustomer method, method returns depersonalized customer Data
*/
public function testGetCustomerDepersonalizeCustomerData()
{
$this->requestMock->expects($this->once())->method('isAjax')->will($this->returnValue(false));
$this->layoutMock->expects($this->once())->method('isCacheable')->will($this->returnValue(true));
$this->viewMock->expects($this->once())->method('isLayoutLoaded')->will($this->returnValue(true));
$this->moduleManagerMock->expects($this->once())->method('isEnabled')->with($this->equalTo('Magento_PageCache'))->will($this->returnValue(true));
$this->customerSessionMock->expects($this->once())->method('getCustomerGroupId')->will($this->returnValue($this->customerGroupId));
$this->customerInterfaceFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->customerDataMock));
$this->customerDataMock->expects($this->once())->method('setGroupId')->with($this->equalTo($this->customerGroupId))->will($this->returnSelf());
$this->assertEquals($this->customerDataMock, $this->currentCustomer->getCustomer());
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:CurrentCustomerTest.php
注:本文中的Magento\Customer\Api\Data\CustomerInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论