public function setUp() { global $PAGE; $temptree = new global_navigation_test(); $temptree->setUp(); $temptree->node->find('course2', navigation_node::TYPE_COURSE)->make_active(); $page = new navigation_exposed_moodle_page(); $page->set_url($PAGE->url); $page->set_context($PAGE->context); $navigation = new exposed_global_navigation($page); $navigation->children = $temptree->node->children; $navigation->set_initialised(); $page->set_navigation($navigation); $this->cache = new navigation_cache('simpletest_nav'); $this->node = new exposed_navbar($page); }
protected function setUp() { global $PAGE, $SITE; parent::setUp(); $this->resetAfterTest(true); $PAGE->set_url('/'); $PAGE->set_course($SITE); $tempnode = new exposed_global_navigation(); // Create an initial tree structure to work with $cat1 = $tempnode->add('category 1', null, navigation_node::TYPE_CATEGORY, null, 'cat1'); $cat2 = $tempnode->add('category 2', null, navigation_node::TYPE_CATEGORY, null, 'cat2'); $cat3 = $tempnode->add('category 3', null, navigation_node::TYPE_CATEGORY, null, 'cat3'); $sub1 = $cat2->add('sub category 1', null, navigation_node::TYPE_CATEGORY, null, 'sub1'); $sub2 = $cat2->add('sub category 2', null, navigation_node::TYPE_CATEGORY, null, 'sub2'); $sub3 = $cat2->add('sub category 3', null, navigation_node::TYPE_CATEGORY, null, 'sub3'); $course1 = $sub2->add('course 1', null, navigation_node::TYPE_COURSE, null, 'course1'); $course2 = $sub2->add('course 2', null, navigation_node::TYPE_COURSE, null, 'course2'); $course3 = $sub2->add('course 3', null, navigation_node::TYPE_COURSE, null, 'course3'); $section1 = $course2->add('section 1', null, navigation_node::TYPE_SECTION, null, 'sec1'); $section2 = $course2->add('section 2', null, navigation_node::TYPE_SECTION, null, 'sec2'); $section3 = $course2->add('section 3', null, navigation_node::TYPE_SECTION, null, 'sec3'); $act1 = $section2->add('activity 1', null, navigation_node::TYPE_ACTIVITY, null, 'act1'); $act2 = $section2->add('activity 2', null, navigation_node::TYPE_ACTIVITY, null, 'act2'); $act3 = $section2->add('activity 3', null, navigation_node::TYPE_ACTIVITY, null, 'act3'); $res1 = $section2->add('resource 1', null, navigation_node::TYPE_RESOURCE, null, 'res1'); $res2 = $section2->add('resource 2', null, navigation_node::TYPE_RESOURCE, null, 'res2'); $res3 = $section2->add('resource 3', null, navigation_node::TYPE_RESOURCE, null, 'res3'); $tempnode->find('course2', navigation_node::TYPE_COURSE)->make_active(); $page = new navigation_exposed_moodle_page(); $page->set_url($PAGE->url); $page->set_context($PAGE->context); $navigation = new exposed_global_navigation($page); $navigation->children = $tempnode->children; $navigation->set_initialised(); $page->set_navigation($navigation); $this->cache = new navigation_cache('simpletest_nav'); $this->node = new exposed_navbar($page); }