function test_checkMenus() { OA_Admin_Menu::_clearCache(OA_ACCOUNT_ADMIN); $oPluginManager = new OX_Plugin_ComponentGroupManager(); $aMenus[OA_ACCOUNT_ADMIN] = array(0 => array('insertafter' => "999")); $this->assertFalse($oPluginManager->_checkMenus('testPlugin', $aMenus)); $aMenus[OA_ACCOUNT_ADMIN] = array(0 => array('insertbefore' => "999")); $this->assertFalse($oPluginManager->_checkMenus('testPlugin', $aMenus)); $aMenus[OA_ACCOUNT_ADMIN] = array(0 => array('addto' => "999")); $this->assertFalse($oPluginManager->_checkMenus('testPlugin', $aMenus)); $aMenus[OA_ACCOUNT_ADMIN] = array(0 => array('add' => "test-plugin-root", 'link' => "plugins/testPlugin/testPlugin.php", 'data' => 'Test Plugin'), 1 => array('addto' => "test-plugin-root", 'index' => "test-plugin-1", 'link' => "plugins/testPlugin/testPlugin-page.php?action=1", 'data' => 'Test Menu 1'), 2 => array('insertafter' => "test-plugin-1", 'index' => "test-plugin-3", 'link' => "plugins/testPlugin/testPlugin.php?action=3", 'data' => 'Test Menu 3'), 3 => array('insertbefore' => "test-plugin-3", 'index' => "test-plugin-2", 'link' => "plugins/testPlugin/testPlugin.php?action=2", 'data' => 'Test Menu 2')); $oMenu = $oPluginManager->_checkMenus('testPlugin', $aMenus); $this->assertIsA($oMenu, 'OA_Admin_Menu'); $oSection = $oMenu->get('test-plugin-root', false); $this->assertIsA($oSection, 'OA_Admin_Menu_Section'); $this->assertEqual(count($oSection->aSections), 3); $this->assertEqual($oSection->aSections[0]->id, 'test-plugin-1'); $this->assertEqual($oSection->aSections[1]->id, 'test-plugin-2'); $this->assertEqual($oSection->aSections[2]->id, 'test-plugin-3'); $oSection1 = $oMenu->get('test-plugin-1', false); $this->assertIsA($oSection1, 'OA_Admin_Menu_Section'); $this->assertEqual($oSection->aSections[0]->id, $oSection1->id); $oSection2 = $oMenu->get('test-plugin-2', false); $this->assertIsA($oSection2, 'OA_Admin_Menu_Section'); $this->assertEqual($oSection->aSections[1]->id, $oSection2->id); $oSection3 = $oMenu->get('test-plugin-3', false); $this->assertIsA($oSection3, 'OA_Admin_Menu_Section'); $this->assertEqual($oSection->aSections[2]->id, $oSection3->id); $this->assertTrue($oMenu->_saveToCache(OA_ACCOUNT_ADMIN)); $oMenu = $oMenu->_loadFromCache(OA_ACCOUNT_ADMIN); $this->assertIsA($oMenu, 'OA_Admin_Menu'); $oSection = $oMenu->get('test-plugin-root', false); $this->assertIsA($oSection, 'OA_Admin_Menu_Section'); $this->assertEqual(count($oSection->aSections), 3); $this->assertEqual($oSection->aSections[0]->id, 'test-plugin-1'); $this->assertEqual($oSection->aSections[1]->id, 'test-plugin-2'); $this->assertEqual($oSection->aSections[2]->id, 'test-plugin-3'); $oSection1 = $oMenu->get('test-plugin-1', false); $this->assertIsA($oSection1, 'OA_Admin_Menu_Section'); $this->assertEqual($oSection->aSections[0]->id, $oSection1->id); $oSection2 = $oMenu->get('test-plugin-2', false); $this->assertIsA($oSection2, 'OA_Admin_Menu_Section'); $this->assertEqual($oSection->aSections[1]->id, $oSection2->id); $oSection3 = $oMenu->get('test-plugin-3', false); $this->assertIsA($oSection3, 'OA_Admin_Menu_Section'); $this->assertEqual($oSection->aSections[2]->id, $oSection3->id); }