public function testGetUsedAttributeNames()
 {
     $mappingData = array(array('attributeName' => 'a'), array('attributeName' => 'b'), array('attributeName' => 'c'));
     $metadata = new DropDownDependencyDerivedAttributeMetadata();
     $metadata->setScenario('nonAutoBuild');
     $metadata->name = 'someName3';
     $metadata->modelClassName = 'Whatever2';
     $metadata->serializedMetadata = serialize(array('stuff', 1, 'attributeLabels' => array(), 'mappingData' => $mappingData));
     $this->assertTrue($metadata->save());
     $usedModelAttributeNames = $metadata->getUsedAttributeNames();
     $this->assertEquals(array('a', 'b', 'c'), $usedModelAttributeNames);
 }
Exemplo n.º 2
0
 /**
  * (non-PHPdoc)
  * @see Element::renderControlNonEditable()
  */
 protected function renderControlNonEditable()
 {
     $attributes = $this->dropDownDependencyDerivedAttributeMetadata->getUsedAttributeNames();
     $content = null;
     foreach ($attributes as $attribute) {
         $element = new DropDownElement($this->model, $attribute, $this->form);
         $element->nonEditableTemplate = $this->getNonEditableTemplate();
         if ($content != null) {
             $content .= ' → ';
         }
         $content .= $element->render();
     }
     return $content;
 }