本文整理汇总了PHP中Magento\Backend\Model\Session::setCustomerData方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::setCustomerData方法的具体用法?PHP Session::setCustomerData怎么用?PHP Session::setCustomerData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Model\Session
的用法示例。
在下文中一共展示了Session::setCustomerData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToHtmlEmptyGlobalShareAndSessionData
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDataFixture Magento/Core/_files/second_third_store.php
* @magentoConfigFixture current_store customer/account_share/scope 0
*/
public function testToHtmlEmptyGlobalShareAndSessionData()
{
$this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1);
$customer = $this->customerAccountService->getCustomer(1);
$this->backendSession->setCustomerData(array('account' => $customer->__toArray()));
$block = $this->layout->createBlock('Magento\\Customer\\Block\\Adminhtml\\Edit\\Tab\\View\\Accordion');
$html = $block->toHtml();
$this->assertContains('Wishlist - 0 item(s)', $html);
$this->assertContains('Shopping Cart of Main Website - 0 item(s)', $html);
$this->assertContains('Shopping Cart of Second Website - 0 item(s)', $html);
$this->assertContains('Shopping Cart of Third Website - 0 item(s)', $html);
}
示例2: testNewCustomer
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
*/
public function testNewCustomer()
{
$customerBuilder = $this->objectManager->get('\\Magento\\Customer\\Service\\V1\\Data\\CustomerBuilder');
$this->backendSession->setCustomerData(array('customer_id' => 0, 'account' => $customerBuilder->create()->__toArray()));
$result = $this->accountBlock->initForm()->toHtml();
// Contains send email controls
$this->assertContains('<input id="_accountsendemail"', $result);
$this->assertContains('<select id="_accountsendemail_store_id"', $result);
}
示例3: testNewCustomer
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
*/
public function testNewCustomer()
{
/** @var \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory */
$customerFactory = $this->objectManager->get('Magento\\Customer\\Api\\Data\\CustomerInterfaceFactory');
$customerData = $this->dataObjectProcessor->buildOutputDataArray($customerFactory->create(), '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$this->backendSession->setCustomerData(['customer_id' => 0, 'account' => $customerData]);
$result = $this->accountBlock->initForm()->toHtml();
// Contains send email controls
$this->assertContains('<input id="_accountsendemail"', $result);
$this->assertContains('<select id="_accountsendemail_store_id"', $result);
}
示例4: setupExistingCustomerData
/**
* Put existing customer data into the backend session
*/
protected function setupExistingCustomerData()
{
/** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
$customer = $this->_customerRepository->getById(1);
$this->_customerData = ['customer_id' => $customer->getId(), 'account' => $this->customerMapper->toFlatArray($customer)];
$this->_customerData['account']['id'] = $customer->getId();
/** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */
$addresses = $customer->getAddresses();
foreach ($addresses as $addressData) {
$this->_customerData['address'][$addressData->getId()] = $this->addressMapper->toFlatArray($addressData);
$this->_customerData['address'][$addressData->getId()]['id'] = $addressData->getId();
}
$this->_backendSession->setCustomerData($this->_customerData);
}
示例5: setupExistingCustomerData
/**
* Put existing customer data into the backend session
*/
protected function setupExistingCustomerData()
{
/** @var Customer $customer */
$customer = $this->_customerAccountService->getCustomer(1);
$this->_customerData = array('customer_id' => $customer->getId(), 'account' => \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer));
$this->_customerData['account']['id'] = $customer->getId();
/** @var Address[] $addresses */
$addresses = $this->_addressService->getAddresses(1);
foreach ($addresses as $addressData) {
$this->_customerData['address'][$addressData->getId()] = AddressConverter::toFlatArray($addressData);
$this->_customerData['address'][$addressData->getId()]['id'] = $addressData->getId();
}
$this->_backendSession->setCustomerData($this->_customerData);
}