66
77namespace 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