Skip to content

Commit db20a40

Browse files
committed
Merge remote-tracking branch 'origin/MC-38269' into 2.4-develop-pr44
2 parents 4dc33c0 + 08c6ac7 commit db20a40

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

app/code/Magento/Persistent/view/frontend/templates/additional.phtml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44
* See COPYING.txt for license details.
55
*/
66
?>
7-
<?php if ($block->getCustomerId()) :?>
8-
<span>
9-
<a <?= /* @noEscape */ $block->getLinkAttributes()?>><?= $block->escapeHtml(__('Not you?'));?></a>
10-
</span>
11-
<?php endif;?>
127
<script type="application/javascript">
13-
window.persistent = <?= /* @noEscape */ $block->getConfig(); ?>;
8+
window.persistent = <?=/* @noEscape */ $block->getConfig()?>;
9+
window.notYouLink = '<?=/* @noEscape */ $block->getLinkAttributes()?>';
1410
</script>
1511
<script type="text/x-magento-init">
1612
{

app/code/Magento/Persistent/view/frontend/web/js/view/additional-welcome.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ define([
4040

4141
$(this).attr('data-bind', html);
4242
$(this).html(html);
43+
$(this).after(' <span><a ' + window.notYouLink + '>' + $t('Not you?') + '</a></span>');
4344
});
4445
}
4546
}

dev/tests/integration/testsuite/Magento/Persistent/Block/Header/AdditionalTest.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,47 @@
66

77
namespace Magento\Persistent\Block\Header;
88

9+
use Magento\Customer\Model\Session;
10+
use Magento\Framework\ObjectManagerInterface;
11+
use Magento\Persistent\Helper\Session as SessionHelper;
12+
use Magento\TestFramework\Helper\Bootstrap;
13+
use PHPUnit\Framework\TestCase;
14+
915
/**
1016
* @magentoDataFixture Magento/Persistent/_files/persistent.php
1117
*/
12-
class AdditionalTest extends \PHPUnit\Framework\TestCase
18+
class AdditionalTest extends TestCase
1319
{
1420
/**
15-
* @var \Magento\Persistent\Block\Header\Additional
21+
* @var Additional
1622
*/
1723
protected $_block;
1824

1925
/**
20-
* @var \Magento\Persistent\Helper\Session
26+
* @var SessionHelper
2127
*/
2228
protected $_persistentSessionHelper;
2329

2430
/**
25-
* @var \Magento\Customer\Model\Session
31+
* @var Session
2632
*/
2733
protected $_customerSession;
2834

2935
/**
30-
* @var \Magento\Framework\ObjectManagerInterface
36+
* @var ObjectManagerInterface
3137
*/
3238
protected $_objectManager;
3339

3440
protected function setUp(): void
3541
{
36-
$this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
42+
$this->_objectManager = Bootstrap::getObjectManager();
3743

38-
/** @var \Magento\Persistent\Helper\Session $persistentSessionHelper */
39-
$this->_persistentSessionHelper = $this->_objectManager->create(\Magento\Persistent\Helper\Session::class);
44+
/** @var Session $persistentSessionHelper */
45+
$this->_persistentSessionHelper = $this->_objectManager->create(Session::class);
4046

41-
$this->_customerSession = $this->_objectManager->get(\Magento\Customer\Model\Session::class);
47+
$this->_customerSession = $this->_objectManager->get(Session::class);
4248

43-
$this->_block = $this->_objectManager->create(\Magento\Persistent\Block\Header\Additional::class);
49+
$this->_block = $this->_objectManager->create(Additional::class);
4450
}
4551

4652
/**
@@ -54,12 +60,7 @@ protected function setUp(): void
5460
public function testToHtml()
5561
{
5662
$this->_customerSession->loginById(1);
57-
$translation = __('Not you?');
58-
59-
$this->assertStringContainsString(
60-
'<a href="' . $this->_block->getHref() . '">' . $translation . '</a>',
61-
$this->_block->toHtml()
62-
);
63+
$this->assertStringContainsString($this->_block->getHref(), $this->_block->toHtml());
6364
$this->_customerSession->logout();
6465
}
6566
}

0 commit comments

Comments
 (0)