当前位置: 首页>>代码示例>>PHP>>正文


PHP CMSMenu::get_menu_item方法代码示例

本文整理汇总了PHP中CMSMenu::get_menu_item方法的典型用法代码示例。如果您正苦于以下问题:PHP CMSMenu::get_menu_item方法的具体用法?PHP CMSMenu::get_menu_item怎么用?PHP CMSMenu::get_menu_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMSMenu的用法示例。


在下文中一共展示了CMSMenu::get_menu_item方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAdvancedMenuHandling

	public function testAdvancedMenuHandling() {
	
		// Populate from CMS Classes, check for existance of SecurityAdmin
		CMSMenu::clear_menu();
		CMSMenu::populate_menu();
		$menuItem = CMSMenu::get_menu_item('SecurityAdmin');
		$this->assertType('CMSMenuItem', $menuItem, 'SecurityAdmin menu item exists');
		$this->assertEquals($menuItem->url, singleton('SecurityAdmin')->Link(), 'Menu item has the correct link');
		$this->assertEquals($menuItem->controller, 'SecurityAdmin', 'Menu item has the correct controller class');
		$this->assertEquals(
			$menuItem->priority, 
			singleton('SecurityAdmin')->stat('menu_priority'), 
			'Menu item has the correct priority'
		);		
		
		// Check that menu order is correct by priority
		// Note this will break if populate_menu includes normal links (ie, as not controller)
		$menuItems = CMSMenu::get_menu_items();
		$priority = 9999; // ok, *could* be set larger, but shouldn't need to be!
		foreach($menuItems as $menuItem) {
			$this->assertEquals(
				$menuItem->priority, 
				singleton($menuItem->controller)->stat('menu_priority'), 
				"Menu item $menuItem->title has the correct priority"
			);			
			$this->assertLessThanOrEqual($priority, $menuItem->priority, 'Menu item is of lower or equal priority');
		}
	}
开发者ID:redema,项目名称:sapphire,代码行数:28,代码来源:CMSMenuTest.php


注:本文中的CMSMenu::get_menu_item方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。