public function testNavigationOrder() { $main = $this->navigation->getNavigation($this->data['news']->getUuid(), 'sulu_io', 'en', 1); $this->assertEquals(2, count($main)); $this->assertEquals(0, count($main[0]['children'])); $this->assertEquals(0, count($main[1]['children'])); $this->assertEquals($this->data['news/news-1']->getUuid(), $main[0]['uuid']); $this->assertEquals('News-1', $main[0]['title']); $this->assertEquals('/news/news-1', $main[0]['url']); $this->assertEquals($this->data['news/news-2']->getUuid(), $main[1]['uuid']); $this->assertEquals('News-2', $main[1]['title']); $this->assertEquals('/news/news-2', $main[1]['url']); $session = $this->sessionManager->getSession(); $session->getNodeByIdentifier($this->data['news/news-1']->getUuid())->setProperty('sulu:order', 100); $session->save(); $session->refresh(false); $main = $this->navigation->getNavigation($this->data['news']->getUuid(), 'sulu_io', 'en', 1); $this->assertEquals(2, count($main)); $this->assertEquals(0, count($main[0]['children'])); $this->assertEquals(0, count($main[1]['children'])); $this->assertEquals($this->data['news/news-2']->getUuid(), $main[0]['uuid']); $this->assertEquals('News-2', $main[0]['title']); $this->assertEquals('/news/news-2', $main[0]['url']); $this->assertEquals($this->data['news/news-1']->getUuid(), $main[1]['uuid']); $this->assertEquals('News-1', $main[1]['title']); $this->assertEquals('/news/news-1', $main[1]['url']); }
/** * {@inheritdoc} */ public function treeNavigationFunction($uuid, $context = null, $depth = 1, $loadExcerpt = false, $level = null) { $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey(); $locale = $this->requestAnalyzer->getCurrentLocalization()->getLocalization(); if ($level !== null) { $breadcrumb = $this->contentMapper->loadBreadcrumb($uuid, $locale, $webspaceKey); // return empty array if level does not exists if (!isset($breadcrumb[$level])) { return []; } $uuid = $breadcrumb[$level]->getUuid(); } return $this->navigationMapper->getNavigation($uuid, $webspaceKey, $locale, $depth, false, $context, $loadExcerpt); }