public function testGetValuesAndLabelsData()
 {
     $moduleClassName = 'AccountsModule';
     $modelAttributesAdapter = DesignerModelToViewUtil::getModelAttributesAdapterByModelForViewClassName($moduleClassName::getGlobalSearchFormClassName(), $moduleClassName::getPrimaryModelName());
     $attributeCollection = $modelAttributesAdapter->getAttributes();
     $this->assertEquals(34, count($attributeCollection));
     $adapter = new ModelAttributeCollectionToGlobalSearchAttributesAdapter($attributeCollection);
     $this->assertEquals(12, count($adapter->getValuesAndLabelsData()));
     $compareData = array('annualRevenue' => 'Annual Revenue', 'anyCity' => 'Any City', 'anyCountry' => 'Any Country', 'anyEmail' => 'Any Email Address', 'anyPostalCode' => 'Any Postal Code', 'anyState' => 'Any State', 'anyStreet' => 'Any Street', 'description' => 'Description', 'employees' => 'Employees', 'name' => 'Name', 'officeFax' => 'Office Fax', 'officePhone' => 'Office Phone');
     $this->assertEquals($compareData, $adapter->getValuesAndLabelsData());
 }
 public function getModuleForm()
 {
     $moduleFormClassName = $this->moduleClassName . 'Form';
     $moduleForm = new $moduleFormClassName();
     //FIGURE OUT HOW TO ONLY MAP SOME ATTRIBUTES SINCE MODULE LABELS ARE HANDLED DIFFERENTLY
     foreach ($moduleForm->attributeNames() as $attributeName) {
         if (isset($this->metadata[$attributeName])) {
             $moduleForm->{$attributeName} = $this->metadata[$attributeName];
         }
     }
     $moduleClassName = $this->moduleClassName;
     foreach (Yii::app()->languageHelper->getActiveLanguagesData() as $languageCode => $languageData) {
         $moduleForm->singularModuleLabels[$languageCode] = $moduleClassName::getModuleLabelByTypeAndLanguage('SingularLowerCase', $languageCode);
         $moduleForm->pluralModuleLabels[$languageCode] = $moduleClassName::getModuleLabelByTypeAndLanguage('PluralLowerCase', $languageCode);
     }
     if ($moduleForm instanceof GlobalSearchEnabledModuleForm) {
         $moduleClassName = $this->moduleClassName;
         $modelAttributesAdapter = DesignerModelToViewUtil::getModelAttributesAdapterByModelForViewClassName($moduleClassName::getGlobalSearchFormClassName(), $moduleClassName::getPrimaryModelName());
         $attributeCollection = $modelAttributesAdapter->getAttributes();
         $adapter = new ModelAttributeCollectionToGlobalSearchAttributesAdapter($attributeCollection);
         $moduleForm->availableGlobalSearchAttributeNames = $adapter->getValuesAndLabelsData();
     }
     return $moduleForm;
 }