/**
  * @depends testModuleFormToMetadataAdapter
  */
 public function testAttributeLabelArrayMergeIsWorking()
 {
     $module = new TestModule(null, null);
     $moduleForm = new TestModuleForm();
     $moduleForm->a = 5;
     $moduleForm->b = 6;
     $moduleForm->c = 7;
     $moduleForm->singularModuleLabels = array('it' => 'git', 'fr' => 'frit', 'de' => 'dit');
     $moduleForm->pluralModuleLabels = array('it' => 'gits', 'fr' => 'frits', 'de' => 'dits');
     $adapter = new ModuleFormToMetadataAdapter($module, $moduleForm);
     $adapter->setMetadata();
     $metadata = $module::getMetadata();
     $this->assertEquals(5, $metadata['global']['a']);
     $this->assertEquals(6, $metadata['global']['b']);
     $this->assertEquals(7, $metadata['global']['c']);
     $singularCompareData = array('en' => 'texs', 'es' => 'texs', 'it' => 'git', 'fr' => 'frit', 'de' => 'dit');
     $this->assertEquals($singularCompareData, $metadata['global']['singularModuleLabels']);
     $pluralCompareData = array('en' => 'texst', 'es' => 'texst', 'it' => 'gits', 'fr' => 'frits', 'de' => 'dits');
     $this->assertEquals($pluralCompareData, $metadata['global']['pluralModuleLabels']);
 }
Example #2
0
 protected function actionModuleSave($moduleForm, $module)
 {
     $moduleForm->setAttributes($_POST[get_class($moduleForm)]);
     $adapter = new ModuleFormToMetadataAdapter($module, $moduleForm);
     $adapter->setMetadata();
     Yii::app()->languageHelper->flushModuleLabelTranslationParameters();
     GeneralCache::forgetAll();
     $routeParams = array_merge(array('default/modulesMenu'), $_GET, array('moduleClassName' => get_class($module)));
     $this->redirect($routeParams);
 }