Skip to content

Commit 390877c

Browse files
committed
MAGETWO-95819: Customer registration fields not translated
- Fixed intergration tests
1 parent b979a07 commit 390877c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class GenderTest extends \PHPUnit\Framework\TestCase
1515
/** @var Gender */
1616
protected $_block;
1717

18+
/** @var \Magento\Customer\Model\Attribute */
19+
private $_model;
20+
1821
/**
1922
* Test initialization and set up. Create the Gender block.
2023
* @return void
@@ -28,6 +31,8 @@ protected function setUp()
2831
)->createBlock(
2932
\Magento\Customer\Block\Widget\Gender::class
3033
);
34+
$this->_model = $objectManager->create(\Magento\Customer\Model\Attribute::class);
35+
$this->_model->loadByCode('customer', 'gender');
3136
}
3237

3338
/**
@@ -49,7 +54,8 @@ public function testGetGenderOptions()
4954
public function testToHtml()
5055
{
5156
$html = $this->_block->toHtml();
52-
$this->assertContains('<span>Gender</span>', $html);
57+
$attributeLabel = $this->_model->getStoreLabel();
58+
$this->assertContains('<span>' . $attributeLabel . '</span>', $html);
5359
$this->assertContains('<option value="1">Male</option>', $html);
5460
$this->assertContains('<option value="2">Female</option>', $html);
5561
$this->assertContains('<option value="3">Not Specified</option>', $html);

dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ public function testToHtml()
2222
\Magento\Customer\Block\Widget\Taxvat::class
2323
);
2424

25-
$this->assertContains('title="Tax&#x2F;VAT&#x20;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());
2632
$this->assertNotContains('required', $block->toHtml());
2733
}
2834

@@ -38,13 +44,14 @@ public function testToHtmlRequired()
3844
);
3945
$model->loadByCode('customer', 'taxvat')->setIsRequired(true);
4046
$model->save();
47+
$attributeLabel = $model->getStoreLabel();
4148

4249
/** @var \Magento\Customer\Block\Widget\Taxvat $block */
4350
$block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
4451
\Magento\Customer\Block\Widget\Taxvat::class
4552
);
4653

47-
$this->assertContains('title="Tax&#x2F;VAT&#x20;Number"', $block->toHtml());
54+
$this->assertContains('title="' . $block->escapeHtmlAttr($attributeLabel) . '"', $block->toHtml());
4855
$this->assertContains('required', $block->toHtml());
4956
}
5057

0 commit comments

Comments
 (0)