public function getIndex() { $indexes = $this->get_full_list(); if (count($indexes)) { $index = $indexes[0]; return $index; } else { $index = new AOD_Index(); $index->name = "Index"; $index->location = "modules/AOD_Index/Index/Index"; $index->save(); return $index; } }
public function getIndex() { $index = BeanFactory::getBean('AOD_Index', 1); if (!empty($index) && !empty($index->id)) { return $index; } else { $index = new AOD_Index(); $index->id = 1; $index->new_with_id = true; $index->name = "Index"; $index->location = "modules/AOD_Index/Index/Index"; $index->save(); return $index; } }
public function testgetIndexableModules() { $expected = array('AM_ProjectTemplates' => 'AM_ProjectTemplates', 'AM_TaskTemplates' => 'AM_TaskTemplates', 'AOK_KnowledgeBase' => 'AOK_KnowledgeBase', 'AOK_Knowledge_Base_Categories' => 'AOK_Knowledge_Base_Categories', 'AOP_Case_Events' => 'AOP_Case_Events', 'AOP_Case_Updates' => 'AOP_Case_Updates', 'AOR_Charts' => 'AOR_Chart', 'AOR_Conditions' => 'AOR_Condition', 'AOR_Fields' => 'AOR_Field', 'AOR_Reports' => 'AOR_Report', 'AOS_Contracts' => 'AOS_Contracts', 'AOS_Product_Categories' => 'AOS_Product_Categories', 'AOW_WorkFlow' => 'AOW_WorkFlow', 'Accounts' => 'Account', 'Bugs' => 'Bug', 'Calls' => 'Call', 'Calls_Reschedule' => 'Calls_Reschedule', 'Campaigns' => 'Campaign', 'Cases' => 'aCase', 'Contacts' => 'Contact', 'DocumentRevisions' => 'DocumentRevision', 'Documents' => 'Document', 'FP_events' => 'FP_events', 'Leads' => 'Lead', 'Meetings' => 'Meeting', 'Notes' => 'Note', 'Opportunities' => 'Opportunity', 'OutboundEmailAccounts' => 'OutboundEmailAccounts', 'Project' => 'Project', 'ProjectTask' => 'ProjectTask', 'ProspectLists' => 'ProspectList', 'Prospects' => 'Prospect', 'Tasks' => 'Task'); $aod_index = new AOD_Index(); //execute the method and verify that it retunrs expected results $actual = $aod_index->getIndexableModules(); $this->assertSame($expected, $actual); }