/** * Test for method filterAttributeCollection() */ public function testFilterAttributeCollection() { /** @var $collection \Magento\Customer\Model\ResourceModel\Attribute\Collection */ $collection = $this->_model->getAttributeCollection(); $collection = $this->_model->filterAttributeCollection($collection); /** * Check that disabled attributes is not existed in attribute collection */ $existedAttributes = []; /** @var $attribute \Magento\Customer\Model\Attribute */ foreach ($collection as $attribute) { $existedAttributes[] = $attribute->getAttributeCode(); } $disabledAttributes = $this->_model->getDisabledAttributes(); foreach ($disabledAttributes as $attributeCode) { $this->assertNotContains($attributeCode, $existedAttributes, 'Disabled attribute "' . $attributeCode . '" existed in collection'); } /** * Check that all overridden attributes were affected during filtering process */ $overriddenAttributes = $this->_model->getOverriddenAttributes(); /** @var $attribute \Magento\Customer\Model\Attribute */ foreach ($collection as $attribute) { if (isset($overriddenAttributes[$attribute->getAttributeCode()])) { foreach ($overriddenAttributes[$attribute->getAttributeCode()] as $propertyKey => $property) { $this->assertEquals($property, $attribute->getData($propertyKey), 'Value of property "' . $propertyKey . '" is not equals'); } } } }