function setUp()
 {
     parent::setUp();
     // @todo fix controller stack problems and re-activate
     //$this->autoFollowRedirection = false;
     CMSMenu::populate_menu();
 }
Пример #2
0
	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');
		}
	}
 public function setUp()
 {
     parent::setUp();
     // @todo fix controller stack problems and re-activate
     //$this->autoFollowRedirection = false;
     CMSMenu::populate_menu();
     $this->backupCss = Config::inst()->get('LeftAndMain', 'extra_requirements_css');
     $this->backupJs = Config::inst()->get('LeftAndMain', 'extra_requirements_javascript');
     $this->backupCombined = Requirements::get_combined_files_enabled();
     Config::inst()->update('LeftAndMain', 'extra_requirements_css', array(FRAMEWORK_DIR . '/tests/assets/LeftAndMainTest.css'));
     Config::inst()->update('LeftAndMain', 'extra_requirements_javascript', array(FRAMEWORK_DIR . '/tests/assets/LeftAndMainTest.js'));
     Requirements::set_combined_files_enabled(false);
 }
Пример #4
0
<?php

/**
 * Extended URL rules for the CMS module
 * 
 * @package cms
 */
Director::addRules(50, array(
	'processes//$Action/$ID/$Batch' => 'BatchProcess_Controller',
	'admin/help//$Action/$ID' => 'CMSHelp',
	'admin/ReportField//$Action/$ID/$Type/$OtherID' => 'ReportField_Controller',
	'admin/bulkload//$Action/$ID/$OtherID' => 'BulkLoaderAdmin',
	'admin//ImageEditor/$Action' => 'ImageEditor',
	'admin/cms//$Action/$ID/$OtherID' => 'CMSMain', 
	'PageComment//$Action/$ID' => 'PageComment_Controller',
	'dev/buildcache' => 'RebuildStaticCacheTask',
));

CMSMenu::populate_menu();
?>
 /**
  * Clear menu to default state as per LeftAndMain::init()
  */
 protected function resetMenu()
 {
     CMSMenu::clear_menu();
     CMSMenu::populate_menu();
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', 'Menu title'), LeftAndMain::config()->help_link, -2, array('target' => '_blank'));
 }