6
6
7
7
namespace Magento \Persistent \Block \Header ;
8
8
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
+
9
15
/**
10
16
* @magentoDataFixture Magento/Persistent/_files/persistent.php
11
17
*/
12
- class AdditionalTest extends \ PHPUnit \ Framework \ TestCase
18
+ class AdditionalTest extends TestCase
13
19
{
14
20
/**
15
- * @var \Magento\Persistent\Block\Header\ Additional
21
+ * @var Additional
16
22
*/
17
23
protected $ _block ;
18
24
19
25
/**
20
- * @var \Magento\Persistent\Helper\Session
26
+ * @var SessionHelper
21
27
*/
22
28
protected $ _persistentSessionHelper ;
23
29
24
30
/**
25
- * @var \Magento\Customer\Model\ Session
31
+ * @var Session
26
32
*/
27
33
protected $ _customerSession ;
28
34
29
35
/**
30
- * @var \Magento\Framework\ ObjectManagerInterface
36
+ * @var ObjectManagerInterface
31
37
*/
32
38
protected $ _objectManager ;
33
39
34
40
protected function setUp (): void
35
41
{
36
- $ this ->_objectManager = \ Magento \ TestFramework \ Helper \ Bootstrap::getObjectManager ();
42
+ $ this ->_objectManager = Bootstrap::getObjectManager ();
37
43
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);
40
46
41
- $ this ->_customerSession = $ this ->_objectManager ->get (\ Magento \ Customer \ Model \ Session::class);
47
+ $ this ->_customerSession = $ this ->_objectManager ->get (Session::class);
42
48
43
- $ this ->_block = $ this ->_objectManager ->create (\ Magento \ Persistent \ Block \ Header \ Additional::class);
49
+ $ this ->_block = $ this ->_objectManager ->create (Additional::class);
44
50
}
45
51
46
52
/**
@@ -54,12 +60,7 @@ protected function setUp(): void
54
60
public function testToHtml ()
55
61
{
56
62
$ 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 ());
63
64
$ this ->_customerSession ->logout ();
64
65
}
65
66
}
0 commit comments