File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
dev/tests/integration/testsuite/Magento/Customer/Block/Widget Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ class GenderTest extends \PHPUnit\Framework\TestCase
15
15
/** @var Gender */
16
16
protected $ _block ;
17
17
18
+ /** @var \Magento\Customer\Model\Attribute */
19
+ private $ _model ;
20
+
18
21
/**
19
22
* Test initialization and set up. Create the Gender block.
20
23
* @return void
@@ -28,6 +31,8 @@ protected function setUp()
28
31
)->createBlock (
29
32
\Magento \Customer \Block \Widget \Gender::class
30
33
);
34
+ $ this ->_model = $ objectManager ->create (\Magento \Customer \Model \Attribute::class);
35
+ $ this ->_model ->loadByCode ('customer ' , 'gender ' );
31
36
}
32
37
33
38
/**
@@ -49,7 +54,8 @@ public function testGetGenderOptions()
49
54
public function testToHtml ()
50
55
{
51
56
$ html = $ this ->_block ->toHtml ();
52
- $ this ->assertContains ('<span>Gender</span> ' , $ html );
57
+ $ attributeLabel = $ this ->_model ->getStoreLabel ();
58
+ $ this ->assertContains ('<span> ' . $ attributeLabel . '</span> ' , $ html );
53
59
$ this ->assertContains ('<option value="1">Male</option> ' , $ html );
54
60
$ this ->assertContains ('<option value="2">Female</option> ' , $ html );
55
61
$ this ->assertContains ('<option value="3">Not Specified</option> ' , $ html );
Original file line number Diff line number Diff line change @@ -22,7 +22,13 @@ public function testToHtml()
22
22
\Magento \Customer \Block \Widget \Taxvat::class
23
23
);
24
24
25
- $ this ->assertContains ('title="Tax/VAT Number" ' , $ block ->toHtml ());
25
+ $ model = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
26
+ \Magento \Customer \Model \Attribute::class
27
+ );
28
+ $ model ->loadByCode ('customer ' , 'taxvat ' );
29
+ $ attributeLabel = $ model ->getStoreLabel ();
30
+
31
+ $ this ->assertContains ('title=" ' . $ block ->escapeHtmlAttr ($ attributeLabel ) . '" ' , $ block ->toHtml ());
26
32
$ this ->assertNotContains ('required ' , $ block ->toHtml ());
27
33
}
28
34
@@ -38,13 +44,14 @@ public function testToHtmlRequired()
38
44
);
39
45
$ model ->loadByCode ('customer ' , 'taxvat ' )->setIsRequired (true );
40
46
$ model ->save ();
47
+ $ attributeLabel = $ model ->getStoreLabel ();
41
48
42
49
/** @var \Magento\Customer\Block\Widget\Taxvat $block */
43
50
$ block = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
44
51
\Magento \Customer \Block \Widget \Taxvat::class
45
52
);
46
53
47
- $ this ->assertContains ('title="Tax/VAT Number " ' , $ block ->toHtml ());
54
+ $ this ->assertContains ('title=" ' . $ block -> escapeHtmlAttr ( $ attributeLabel ) . ' " ' , $ block ->toHtml ());
48
55
$ this ->assertContains ('required ' , $ block ->toHtml ());
49
56
}
50
57
You can’t perform that action at this time.
0 commit comments