AddressTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Helper;
  7. class AddressTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /** @var \Magento\Customer\Helper\Address */
  10. protected $helper;
  11. protected function setUp()
  12. {
  13. $this->helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
  14. \Magento\Customer\Helper\Address::class
  15. );
  16. }
  17. /**
  18. * @param $attributeCode
  19. * @dataProvider getAttributeValidationClass
  20. */
  21. public function testGetAttributeValidationClass($attributeCode, $expectedClass)
  22. {
  23. $this->assertEquals($expectedClass, $this->helper->getAttributeValidationClass($attributeCode));
  24. }
  25. public function getAttributeValidationClass()
  26. {
  27. return [
  28. ['bad-code', ''],
  29. ['city', 'required-entry'],
  30. ['company', ''],
  31. ['country_id', 'required-entry'],
  32. ['fax', ''],
  33. ['firstname', 'required-entry'],
  34. ['lastname', 'required-entry'],
  35. ['middlename', ''],
  36. ['postcode', '']
  37. ];
  38. }
  39. }