/**
  * @covers Navigation::addPage
  */
 public function testAddPage()
 {
     $navigation = new Navigation();
     $navigation->addPage('Title');
     $this->assertEquals(1, $navigation->countPages());
     $navigation->addPage(['title' => 'Test 4', 'icon' => 'fa fa-user', 'priority' => 700, 'url' => 'http://site.com']);
     $this->assertEquals(2, $navigation->countPages());
     $navigation->addPage(new Page('Test 5'));
     $this->assertEquals(3, $navigation->countPages());
     $this->assertEquals(['b78a3223503896721cca1303f776159b' => ['child' => [], 'hasChild' => false, 'id' => 'b78a3223503896721cca1303f776159b', 'title' => 'Title', 'icon' => null, 'priority' => 100, 'url' => null, 'path' => ['Title'], 'isActive' => false, 'attributes' => '', 'badge' => null], '9fe74bb46baed663321329a1fc479e8b' => ['child' => [], 'hasChild' => false, 'id' => '9fe74bb46baed663321329a1fc479e8b', 'title' => 'Test 4', 'icon' => '<i class="fa fa-user"></i>', 'priority' => 700, 'url' => 'http://site.com', 'path' => ['Test 4'], 'isActive' => false, 'attributes' => '', 'badge' => null], 'ce03a4296e564386d37eb22a7dce0623' => ['child' => [], 'hasChild' => false, 'id' => 'ce03a4296e564386d37eb22a7dce0623', 'title' => 'Test 5', 'icon' => null, 'priority' => 100, 'url' => null, 'path' => ['Test 5'], 'isActive' => false, 'attributes' => '', 'badge' => null]], $navigation->toArray());
 }
Esempio n. 2
0
 /**
  * @param string|array|PageInterface|null $page
  *
  * @return PageInterface|null
  */
 public function addPage($page = null)
 {
     if ($page = parent::addPage($page)) {
         $page->setParent($this);
     }
     return $page;
 }