/** * @magentoConfigFixture current_store persistent/options/customer 1 * @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 testToHtml() { $this->_customerSession->loginById(1); $translation = __('Not you?'); $this->assertStringMatchesFormat('%A<span>%A<a%Ahref="' . $this->_block->getHref() . '"%A>' . $translation . '</a>%A</span>%A', $this->_block->toHtml()); $this->_customerSession->logout(); }
/** * @magentoConfigFixture current_store persistent/options/customer 1 * @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 testToHtml() { $this->_customerSession->loginById(1); /** @var \Magento\Customer\Helper\View $customerViewHelper */ $customerViewHelper = $this->_objectManager->create('Magento\\Customer\\Helper\\View'); $customerAccountService = $this->_objectManager->create('Magento\\Customer\\Service\\V1\\CustomerAccountServiceInterface'); /** @var \Magento\Framework\Escaper $escaper */ $escaper = $this->_objectManager->create('Magento\\Framework\\Escaper'); $persistentName = $escaper->escapeHtml($customerViewHelper->getCustomerName($customerAccountService->getCustomer($this->_persistentSessionHelper->getSession()->getCustomerId()))); $translation = __('(Not %1?)', $persistentName); $this->assertStringMatchesFormat('%A<span>%A<a%Ahref="' . $this->_block->getHref() . '"%A>' . $translation . '</a>%A</span>%A', $this->_block->toHtml()); $this->_customerSession->logout(); }