public function testGetCustomFieldAttributesNotUsedInOtherDependencyAttributes() { $adapter = new DropDownDependencyToMappingLayoutAdapter('TestDropDownDependencyModel', null, 4); $attributeNames = $adapter->getCustomFieldAttributesNotUsedInOtherDependencyAttributes(); $availableAttributes = array('something1' => 'Something 1', 'something2' => 'Something 2', 'something3' => 'Something 3', 'something4' => 'Something 4'); $this->assertEquals($availableAttributes, $attributeNames); //Now save a drop down dependency. This means it will use up one of the attribute names. $metadata = new DropDownDependencyDerivedAttributeMetadata(); $metadata->setScenario('nonAutoBuild'); $metadata->name = 'someName'; $metadata->modelClassName = 'TestDropDownDependencyModel'; $mappingData = array(array('attributeName' => 'something1')); $metadata->serializedMetadata = serialize(array('stuff', 1, 'attributeLabels' => array(), 'mappingData' => $mappingData)); $this->assertTrue($metadata->save()); //Now requery and see that something1 is not available. $adapter = new DropDownDependencyToMappingLayoutAdapter('TestDropDownDependencyModel', null, 4); $attributeNames = $adapter->getCustomFieldAttributesNotUsedInOtherDependencyAttributes(); $availableAttributes = array('something2' => 'Something 2', 'something3' => 'Something 3', 'something4' => 'Something 4'); $this->assertEquals($availableAttributes, $attributeNames); }