/** * Check if address attribute is visible on frontend * * @param string $attributeCode * @param array $attributeConfig * @param array $additionalConfig field configuration provided via layout XML * @return bool */ protected function isFieldVisible($attributeCode, array $attributeConfig, array $additionalConfig = []) { // TODO move this logic to separate model so it can be customized if ($attributeConfig['visible'] == false || isset($additionalConfig['visible']) && $additionalConfig['visible'] == false) { return false; } if ($attributeCode == 'vat_id' && !$this->addressHelper->isVatAttributeVisible()) { return false; } return true; }
public function testIsVatAttributeVisible() { $this->scopeConfig->expects($this->once())->method('getValue')->with(\Magento\Customer\Helper\Address::XML_PATH_VAT_FRONTEND_VISIBILITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)->will($this->returnValue(true)); $this->assertTrue($this->helper->isVatAttributeVisible()); }