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

PHP Helper\View类代码示例

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

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



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

示例1: testEmulateWelcomeBlock

 /**
  * @magentoConfigFixture current_store persistent/options/enabled 1
  * @magentoConfigFixture current_store persistent/options/remember_enabled 1
  * @magentoConfigFixture current_store persistent/options/remember_default 1
  * @magentoAppArea frontend
  * @magentoAppIsolation enabled
  */
 public function testEmulateWelcomeBlock()
 {
     $this->_customerSession->loginById(1);
     $httpContext = new \Magento\Framework\App\Http\Context();
     $httpContext->setValue(Context::CONTEXT_AUTH, 1, 1);
     $block = $this->_objectManager->create('Magento\\Sales\\Block\\Reorder\\Sidebar', ['httpContext' => $httpContext]);
     $this->_observer->emulateWelcomeBlock($block);
     $customerName = $this->_escaper->escapeHtml($this->_customerViewHelper->getCustomerName($this->customerRepository->getById($this->_persistentSessionHelper->getSession()->getCustomerId())));
     $translation = __('Welcome, %1!', $customerName);
     $this->assertStringMatchesFormat('%A' . $translation . '%A', $block->getWelcome());
     $this->_customerSession->logout();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:ObserverTest.php


示例2: testGetUserName

 public function testGetUserName()
 {
     $this->customerSessionMock->expects($this->once())->method('isLoggedIn')->willReturn(true);
     $customerDataObject = $this->getMockBuilder('\\Magento\\Customer\\Model\\Data\\Customer')->disableOriginalConstructor()->getMock();
     $this->customerSessionMock->expects($this->once())->method('getCustomerDataObject')->willReturn($customerDataObject);
     $this->customerViewHelperMock->expects($this->once())->method('getCustomerName')->willReturn(' customer name ');
     $this->assertEquals('customer name', $this->helper->getUserName());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:8,代码来源:DataTest.php


示例3: emulateWelcomeBlock

 /**
  * Emulate 'welcome' block with persistent data
  *
  * @param \Magento\Framework\View\Element\AbstractBlock $block
  * @return $this
  */
 public function emulateWelcomeBlock($block)
 {
     $escapedName = $this->_escaper->escapeHtml($this->_customerViewHelper->getCustomerName($this->customerRepository->getById($this->_persistentSession->getSession()->getCustomerId())), null);
     $this->_applyAccountLinksPersistentData();
     $welcomeMessage = __('Welcome, %1!', $escapedName) . ' ' . $this->_layout->getBlock('header.additional')->toHtml();
     $block->setWelcome($welcomeMessage);
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:Observer.php


示例4: testGetUserName

 public function testGetUserName()
 {
     $this->_customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(true));
     $objectBuilder = $this->getMockForAbstractClass('\\Magento\\Framework\\Service\\Data\\AbstractSimpleObjectBuilder', ['getData'], '', false);
     $customerDataObject = new \Magento\Customer\Service\V1\Data\Customer($objectBuilder);
     $this->_customerSession->expects($this->once())->method('getCustomerDataObject')->will($this->returnValue($customerDataObject));
     $this->_customerViewHelper->expects($this->once())->method('getCustomerName')->will($this->returnValue(' customer name '));
     $this->assertEquals('customer name', $this->_helper->getUserName());
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:9,代码来源:DataTest.php


示例5: testProcess

 /**
  * @magentoConfigFixture current_store catalog/productalert/allow_price 1
  *
  * @magentoDataFixture Magento/ProductAlert/_files/product_alert.php
  */
 public function testProcess()
 {
     $this->_objectManager->configure(['Magento\\ProductAlert\\Model\\Observer' => ['arguments' => ['transportBuilder' => ['instance' => 'Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock']]], 'Magento\\ProductAlert\\Model\\Email' => ['arguments' => ['transportBuilder' => ['instance' => 'Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock']]], 'preferences' => ['Magento\\Framework\\Mail\\TransportInterface' => 'Magento\\TestFramework\\Mail\\TransportInterfaceMock', 'Magento\\TestFramework\\Mail\\Template\\TransportBuilder' => 'Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock']]);
     \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
     $observer = $this->_objectManager->get('Magento\\ProductAlert\\Model\\Observer');
     $observer->process();
     /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */
     $transportBuilder = $this->_objectManager->get('Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock');
     $this->assertStringMatchesFormat('%AHello %A' . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) . ',%A', $transportBuilder->getSentMessage()->getBodyHtml()->getContent());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:15,代码来源:ObserverTest.php


示例6: getUserName

 /**
  * Get user name
  *
  * @return string
  */
 public function getUserName()
 {
     if (!$this->_customerSession->isLoggedIn()) {
         return '';
     }
     /**
      * @var \Magento\Customer\Api\Data\CustomerInterface $customer
      */
     $customer = $this->_customerSession->getCustomerDataObject();
     return trim($this->_customerViewHelper->getCustomerName($customer));
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:Data.php


示例7: getWelcome

 /**
  * Retrieve welcome text
  *
  * @return string
  */
 public function getWelcome()
 {
     if (empty($this->_data['welcome'])) {
         if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
             $customerName = $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject());
             $this->_data['welcome'] = __('Welcome, %1!', $this->escapeHtml($customerName));
         } else {
             $this->_data['welcome'] = $this->_scopeConfig->getValue('design/header/welcome', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
         }
     }
     return $this->_data['welcome'];
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:Header.php


示例8: getUserName

 /**
  * Retrieve username for form field
  *
  * @return string
  */
 public function getUserName()
 {
     $name = $this->getFormData()->getData('sender/name');
     if (!empty($name)) {
         return trim($name);
     }
     /* @var $session \Magento\Customer\Model\Session */
     $session = $this->_customerSession;
     if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
         return $this->_customerViewHelper->getCustomerName($session->getCustomerDataObject());
     }
     return '';
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:Send.php


示例9: prepareInitiatePasswordReset

 /**
  * @param string $email
  * @param string $templateIdentifier
  * @param string $sender
  * @param int $storeId
  * @param int $customerId
  * @param string $hash
  */
 protected function prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash)
 {
     $websiteId = 1;
     $dateTime = date(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
     $customerData = ['key' => 'value'];
     $customerName = 'Customer Name';
     $this->store->expects($this->once())->method('getWebsiteId')->willReturn($websiteId);
     $this->store->expects($this->any())->method('getId')->willReturn($storeId);
     $this->storeManager->expects($this->any())->method('getStore')->willReturn($this->store);
     $customer = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->getMock();
     $customer->expects($this->any())->method('getEmail')->willReturn($email);
     $customer->expects($this->any())->method('getId')->willReturn($customerId);
     $customer->expects($this->any())->method('getStoreId')->willReturn($storeId);
     $this->customerRepository->expects($this->once())->method('get')->with($email, $websiteId)->willReturn($customer);
     $this->customerRepository->expects($this->once())->method('save')->with($customer)->willReturnSelf();
     $this->random->expects($this->once())->method('getUniqueHash')->willReturn($hash);
     $this->customerViewHelper->expects($this->any())->method('getCustomerName')->with($customer)->willReturn($customerName);
     $this->customerSecure->expects($this->any())->method('setRpToken')->with($hash)->willReturnSelf();
     $this->customerSecure->expects($this->any())->method('setRpTokenCreatedAt')->with($dateTime)->willReturnSelf();
     $this->customerSecure->expects($this->any())->method('addData')->with($customerData)->willReturnSelf();
     $this->customerSecure->expects($this->any())->method('setData')->with('name', $customerName)->willReturnSelf();
     $this->customerRegistry->expects($this->any())->method('retrieveSecureData')->with($customerId)->willReturn($this->customerSecure);
     $this->dataObjectProcessor->expects($this->any())->method('buildOutputDataArray')->with($customer, '\\Magento\\Customer\\Api\\Data\\CustomerInterface')->willReturn($customerData);
     $this->prepareEmailSend($email, $templateIdentifier, $sender, $storeId, $customerName);
 }
开发者ID:nja78,项目名称:magento2,代码行数:33,代码来源:AccountManagementTest.php


示例10: load

 /**
  * Load search results
  *
  * @return $this
  */
 public function load()
 {
     $result = [];
     if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
         $this->setResults($result);
         return $this;
     }
     $this->searchCriteriaBuilder->setCurrentPage($this->getStart());
     $this->searchCriteriaBuilder->setPageSize($this->getLimit());
     $searchFields = ['firstname', 'lastname', 'company'];
     $filters = [];
     foreach ($searchFields as $field) {
         $filters[] = $this->filterBuilder->setField($field)->setConditionType('like')->setValue($this->getQuery() . '%')->create();
     }
     $this->searchCriteriaBuilder->addFilters($filters);
     $searchCriteria = $this->searchCriteriaBuilder->create();
     $searchResults = $this->customerRepository->getList($searchCriteria);
     foreach ($searchResults->getItems() as $customer) {
         $customerAddresses = $customer->getAddresses();
         /** Look for a company name defined in default billing address */
         $company = null;
         foreach ($customerAddresses as $customerAddress) {
             if ($customerAddress->getId() == $customer->getDefaultBilling()) {
                 $company = $customerAddress->getCompany();
                 break;
             }
         }
         $result[] = ['id' => 'customer/1/' . $customer->getId(), 'type' => __('Customer'), 'name' => $this->_customerViewHelper->getCustomerName($customer), 'description' => $company, 'url' => $this->_adminhtmlData->getUrl('customer/index/edit', ['id' => $customer->getId()])];
     }
     $this->setResults($result);
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:37,代码来源:Customer.php


示例11: testNewAccount

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function testNewAccount()
 {
     $customerId = 1;
     $customerStoreId = 2;
     $customerEmail = '[email protected]';
     $customerData = ['key' => 'value'];
     $customerName = 'Customer Name';
     $templateIdentifier = 'Template Identifier';
     $sender = 'Sender';
     $customer = $this->getMock(\Magento\Customer\Api\Data\CustomerInterface::class, [], [], '', false);
     $customer->expects($this->any())->method('getStoreId')->willReturn($customerStoreId);
     $customer->expects($this->any())->method('getId')->willReturn($customerId);
     $customer->expects($this->any())->method('getEmail')->willReturn($customerEmail);
     $this->storeMock->expects($this->any())->method('getId')->willReturn($customerStoreId);
     $this->storeManagerMock->expects($this->once())->method('getStore')->with($customerStoreId)->willReturn($this->storeMock);
     $this->customerRegistryMock->expects($this->once())->method('retrieveSecureData')->with($customerId)->willReturn($this->customerSecureMock);
     $this->dataProcessorMock->expects($this->once())->method('buildOutputDataArray')->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class)->willReturn($customerData);
     $this->customerViewHelperMock->expects($this->any())->method('getCustomerName')->with($customer)->willReturn($customerName);
     $this->customerSecureMock->expects($this->once())->method('addData')->with($customerData)->willReturnSelf();
     $this->customerSecureMock->expects($this->once())->method('setData')->with('name', $customerName)->willReturnSelf();
     $this->scopeConfigMock->expects($this->at(0))->method('getValue')->with(EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE, ScopeInterface::SCOPE_STORE, $customerStoreId)->willReturn($templateIdentifier);
     $this->scopeConfigMock->expects($this->at(1))->method('getValue')->with(EmailNotification::XML_PATH_REGISTER_EMAIL_IDENTITY, ScopeInterface::SCOPE_STORE, $customerStoreId)->willReturn($sender);
     $transport = $this->getMock(\Magento\Framework\Mail\TransportInterface::class, [], [], '', false);
     $this->transportBuilderMock->expects($this->once())->method('setTemplateIdentifier')->with($templateIdentifier)->willReturnSelf();
     $this->transportBuilderMock->expects($this->once())->method('setTemplateOptions')->with(['area' => Area::AREA_FRONTEND, 'store' => $customerStoreId])->willReturnSelf();
     $this->transportBuilderMock->expects($this->once())->method('setTemplateVars')->with(['customer' => $this->customerSecureMock, 'back_url' => '', 'store' => $this->storeMock])->willReturnSelf();
     $this->transportBuilderMock->expects($this->once())->method('setFrom')->with($sender)->willReturnSelf();
     $this->transportBuilderMock->expects($this->once())->method('addTo')->with($customerEmail, $customerName)->willReturnSelf();
     $this->transportBuilderMock->expects($this->once())->method('getTransport')->willReturn($transport);
     $transport->expects($this->once())->method('sendMessage');
     $this->model->newAccount($customer, EmailNotification::NEW_ACCOUNT_EMAIL_REGISTERED, '', $customerStoreId);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:35,代码来源:EmailNotificationTest.php


示例12: getFullCustomerObject

 /**
  * Create an object with data merged from Customer and CustomerSecure
  *
  * @param CustomerInterface $customer
  * @return \Magento\Customer\Model\Data\CustomerSecure
  */
 private 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::class);
     $mergedCustomerData->addData($customerData);
     $mergedCustomerData->setData('name', $this->customerViewHelper->getCustomerName($customer));
     return $mergedCustomerData;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:EmailNotification.php


示例13: getUserName

 /**
  * Get user name
  *
  * @return string
  */
 public function getUserName()
 {
     if (!$this->_customerSession->isLoggedIn()) {
         return '';
     }
     /**
      * @var Customer $customer
      */
     $customer = $this->_customerSession->getCustomerDataObject();
     return trim($this->_customerViewHelper->getCustomerName($customer));
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:Data.php


示例14: testSendNotificationEmailsIfRequired

 /**
  * @param int $testNumber
  * @param string $oldEmail
  * @param string $newEmail
  * @param bool $isPasswordChanged
  *
  * @dataProvider sendNotificationEmailsDataProvider
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function testSendNotificationEmailsIfRequired($testNumber, $oldEmail, $newEmail, $isPasswordChanged)
 {
     $customerId = 1;
     $customerStoreId = 2;
     $customerWebsiteId = 1;
     $customerData = ['key' => 'value'];
     $customerName = 'Customer Name';
     $templateIdentifier = 'Template Identifier';
     $sender = 'Sender';
     switch ($testNumber) {
         case 1:
             $xmlPathTemplate = EmailNotification::XML_PATH_RESET_PASSWORD_TEMPLATE;
             $expects = $this->once();
             break;
         case 2:
             $xmlPathTemplate = EmailNotification::XML_PATH_CHANGE_EMAIL_TEMPLATE;
             $expects = $this->exactly(2);
             break;
         case 3:
             $xmlPathTemplate = EmailNotification::XML_PATH_CHANGE_EMAIL_AND_PASSWORD_TEMPLATE;
             $expects = $this->exactly(2);
             break;
     }
     $origCustomer = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->getMock();
     $origCustomer->expects($this->any())->method('getStoreId')->willReturn(0);
     $origCustomer->expects($this->any())->method('getId')->willReturn($customerId);
     $origCustomer->expects($this->any())->method('getWebsiteId')->willReturn($customerWebsiteId);
     $storeMock = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $storeMock->expects($this->any())->method('getId')->willReturn($customerStoreId);
     $this->storeManagerMock->expects(clone $expects)->method('getStore')->willReturn($storeMock);
     $websiteMock = $this->getMockBuilder('Magento\\Store\\Model\\Website')->disableOriginalConstructor()->setMethods(['getStoreIds'])->getMock();
     $websiteMock->expects($this->any())->method('getStoreIds')->willReturn([$customerStoreId]);
     $this->storeManagerMock->expects(clone $expects)->method('getWebsite')->with($customerWebsiteId)->willReturn($websiteMock);
     $customerSecureMock = $this->getMockBuilder('Magento\\Customer\\Model\\Data\\CustomerSecure')->disableOriginalConstructor()->getMock();
     $this->customerRegistryMock->expects(clone $expects)->method('retrieveSecureData')->with($customerId)->willReturn($customerSecureMock);
     $this->dataProcessorMock->expects(clone $expects)->method('buildOutputDataArray')->with($origCustomer, '\\Magento\\Customer\\Api\\Data\\CustomerInterface')->willReturn($customerData);
     $this->customerViewHelperMock->expects($this->any())->method('getCustomerName')->with($origCustomer)->willReturn($customerName);
     $customerSecureMock->expects(clone $expects)->method('addData')->with($customerData)->willReturnSelf();
     $customerSecureMock->expects(clone $expects)->method('setData')->with('name', $customerName)->willReturnSelf();
     $savedCustomer = clone $origCustomer;
     $origCustomer->expects($this->any())->method('getEmail')->willReturn($oldEmail);
     $savedCustomer->expects($this->any())->method('getEmail')->willReturn($newEmail);
     $this->scopeConfigMock->expects($this->any())->method('getValue')->withConsecutive([$xmlPathTemplate, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $customerStoreId], [\Magento\Customer\Helper\EmailNotification::XML_PATH_FORGOT_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $customerStoreId], [$xmlPathTemplate, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $customerStoreId], [\Magento\Customer\Helper\EmailNotification::XML_PATH_FORGOT_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $customerStoreId])->willReturnOnConsecutiveCalls($templateIdentifier, $sender, $templateIdentifier, $sender);
     $this->transportBuilderMock->expects(clone $expects)->method('setTemplateIdentifier')->with($templateIdentifier)->willReturnSelf();
     $this->transportBuilderMock->expects(clone $expects)->method('setTemplateOptions')->with(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $customerStoreId])->willReturnSelf();
     $this->transportBuilderMock->expects(clone $expects)->method('setTemplateVars')->with(['customer' => $customerSecureMock, 'store' => $storeMock])->willReturnSelf();
     $this->transportBuilderMock->expects(clone $expects)->method('setFrom')->with($sender)->willReturnSelf();
     $this->transportBuilderMock->expects(clone $expects)->method('addTo')->withConsecutive([$oldEmail, $customerName], [$newEmail, $customerName])->willReturnSelf();
     $transport = $this->getMockBuilder('Magento\\Framework\\Mail\\TransportInterface')->getMock();
     $this->transportBuilderMock->expects(clone $expects)->method('getTransport')->willReturn($transport);
     $transport->expects(clone $expects)->method('sendMessage');
     $this->assertEquals($this->helper, $this->helper->sendNotificationEmailsIfRequired($origCustomer, $savedCustomer, $isPasswordChanged));
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:62,代码来源:EmailNotificationTest.php


示例15: testSend

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoDataFixture Magento/Catalog/_files/product_simple.php
  */
 public function testSend()
 {
     $this->_objectManager->configure(['Magento\\ProductAlert\\Model\\Email' => ['arguments' => ['transportBuilder' => ['instance' => 'Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock']]], 'preferences' => ['Magento\\Framework\\Mail\\TransportInterface' => 'Magento\\TestFramework\\Mail\\TransportInterfaceMock']]);
     \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
     $this->_emailModel = $this->_objectManager->create('Magento\\ProductAlert\\Model\\Email');
     /** @var \Magento\Store\Model\Website $website */
     $website = $this->_objectManager->create('Magento\\Store\\Model\\Website');
     $website->load(1);
     $this->_emailModel->setWebsite($website);
     /** @var \Magento\Customer\Service\V1\Data\Customer $customer */
     $customer = $this->_customerAccountService->getCustomer(1);
     $this->_emailModel->setCustomerData($customer);
     /** @var \Magento\Catalog\Model\Product $product */
     $product = $this->_objectManager->create('Magento\\Catalog\\Model\\Product');
     $product->load(1);
     $this->_emailModel->addPriceProduct($product);
     $this->_emailModel->send();
     /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */
     $transportBuilder = $this->_objectManager->get('Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock');
     $this->assertStringMatchesFormat('%AHello ' . $this->_customerViewHelper->getCustomerName($customer) . '%A', $transportBuilder->getSentMessage()->getBodyHtml()->getContent());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:25,代码来源:EmailTest.php


示例16: testSendAction

 /**
  * @magentoDataFixture Magento/Wishlist/_files/wishlist.php
  */
 public function testSendAction()
 {
     \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
     $request = ['form_key' => $this->_objectManager->get('Magento\\Framework\\Data\\Form\\FormKey')->getFormKey(), 'emails' => '[email protected]', 'message' => 'message', 'rss_url' => null];
     $this->getRequest()->setPostValue($request);
     $this->_objectManager->get('Magento\\Framework\\Registry')->register('wishlist', $this->_objectManager->get('Magento\\Wishlist\\Model\\Wishlist')->loadByCustomerId(1));
     $this->dispatch('wishlist/index/send');
     /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */
     $transportBuilder = $this->_objectManager->get('Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock');
     $actualResult = \Zend_Mime_Decode::decodeQuotedPrintable($transportBuilder->getSentMessage()->getBodyHtml()->getContent());
     $this->assertStringMatchesFormat('%A' . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) . ' wants to share this Wish List%A', $actualResult);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:IndexTest.php


示例17: testSendAction

 /**
  * @magentoDataFixture Magento/Wishlist/_files/wishlist.php
  */
 public function testSendAction()
 {
     $this->_objectManager->configure(['Magento\\Wishlist\\Controller\\Index\\Send' => ['arguments' => ['transportBuilder' => ['instance' => 'Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock']]], 'preferences' => ['Magento\\Framework\\Mail\\TransportInterface' => 'Magento\\TestFramework\\Mail\\TransportInterfaceMock']]);
     \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
     $request = ['form_key' => $this->_objectManager->get('Magento\\Framework\\Data\\Form\\FormKey')->getFormKey(), 'emails' => '[email protected]', 'message' => 'message', 'rss_url' => null];
     $this->getRequest()->setPost($request);
     $this->_objectManager->get('Magento\\Framework\\Registry')->register('wishlist', $this->_objectManager->get('Magento\\Wishlist\\Model\\Wishlist')->loadByCustomerId(1));
     $this->dispatch('wishlist/index/send');
     /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */
     $transportBuilder = $this->_objectManager->get('Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock');
     $this->assertStringMatchesFormat('%AThank you, %A' . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) . '%A', $transportBuilder->getSentMessage()->getBodyHtml()->getContent());
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:15,代码来源:IndexTest.php


示例18: _construct

 /**
  * Initialize add new review
  *
  * @return void
  */
 protected function _construct()
 {
     $this->_addButtonLabel = __('New Review');
     parent::_construct();
     $this->_blockGroup = 'Magento_Review';
     $this->_controller = 'adminhtml';
     // lookup customer, if id is specified
     $customerId = $this->getRequest()->getParam('customerId', false);
     $customerName = '';
     if ($customerId) {
         $customer = $this->customerRepository->getById($customerId);
         $customerName = $this->escapeHtml($this->_customerViewHelper->getCustomerName($customer));
     }
     $productId = $this->getRequest()->getParam('productId', false);
     $productName = null;
     if ($productId) {
         $product = $this->_productFactory->create()->load($productId);
         $productName = $this->escapeHtml($product->getName());
     }
     if ($this->_coreRegistry->registry('usePendingFilter') === true) {
         if ($customerName) {
             $this->_headerText = __('Pending Reviews of Customer `%1`', $customerName);
         } else {
             $this->_headerText = __('Pending Reviews');
         }
         $this->buttonList->remove('add');
     } else {
         if ($customerName) {
             $this->_headerText = __('All Reviews of Customer `%1`', $customerName);
         } elseif ($productName) {
             $this->_headerText = __('All Reviews of Product `%1`', $productName);
         } else {
             $this->_headerText = __('All Reviews');
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:41,代码来源:Main.php


示例19: getDefaultSender

 /**
  * Retrieve default value for giftmessage sender
  *
  * @return string
  */
 public function getDefaultSender()
 {
     if (!$this->getEntity()) {
         return '';
     }
     if ($this->_getSession()->hasCustomerId() && $this->_getSession()->getCustomerId()) {
         $customerData = $this->_customerService->getCustomer($this->_getSession()->getCustomerId());
         return $this->_customerViewHelper->getCustomerName($customerData);
     }
     $object = $this->getEntity();
     if ($this->getEntity()->getQuote()) {
         $object = $this->getEntity()->getQuote();
     }
     return $object->getBillingAddress()->getName();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:Form.php


示例20: getDefaultSender

 /**
  * Retrieve default value for giftmessage sender
  *
  * @return string
  */
 public function getDefaultSender()
 {
     if (!$this->getEntity()) {
         return '';
     }
     if ($this->_getSession()->hasCustomerId() && $this->_getSession()->getCustomerId()) {
         // TODO to change email on id
         $customer = $this->customerRepository->getById($this->_getSession()->getCustomerId());
         return $this->_customerViewHelper->getCustomerName($customer);
     }
     $object = $this->getEntity();
     if ($this->getEntity()->getQuote()) {
         $object = $this->getEntity()->getQuote();
     }
     return $object->getBillingAddress()->getName();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:21,代码来源:Form.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Session\CurrentCustomer类代码示例发布时间:2022-05-23
下一篇:
PHP Helper\Address类代码示例发布时间: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