/**
  * testRemoveMenuFail
  *
  * @return void
  * @throws \Exception
  */
 public function testRemoveMenuFail()
 {
     $this->setExpectedException('\\Exception');
     $menuRepo = $this->menuRepository;
     $typeHandler = $this->typeHandler;
     $routeHandler = $this->routeHandler;
     $cacheHandler = $this->cacheHandler;
     $menuHandler = new MenuAlterHandler($menuRepo, $typeHandler, $routeHandler, $cacheHandler);
     $menu = new MenuEntity(['id' => 'testMenu', 'title' => 'testTitle', 'description' => 'testDescription'], new TreeCollection([new MenuItem(['id' => 'testMenu'])]));
     $menuItem = new MenuItem(['id' => 'qna', 'parentId' => 'main', 'ordering' => 1, 'activated' => 1, 'type' => 'pluginA@board', 'title' => 'Q & A', 'description' => '질답 게시판입니다.', 'url' => 'qna']);
     $menu->addItem($menuItem);
     $menuRepo->shouldReceive('findMenu')->with('basic')->andReturn($menu);
     $menuRepo->shouldReceive('deleteMenu')->andReturn();
     $menuHandler->removeMenu($menu);
 }
예제 #2
0
 /**
  * testMenuAddItem
  *
  * @return void
  */
 public function testMenuAddItem()
 {
     $treeCollection = $this->getTreeCollection();
     $menu = new MenuEntity(['id' => 'main', 'title' => '기본메뉴', 'description' => '기본메뉴입니다.'], $treeCollection);
     $menuItem = new MenuItem(['id' => 'qna', 'parentId' => 'main', 'ordering' => 1, 'activated' => 1, 'type' => 'pluginA@board', 'title' => 'Q & A', 'description' => '질답 게시판입니다.', 'url' => 'qna']);
     $menu->addItem($menuItem);
     $foundItem = $menu->getItem('qna');
     $this->assertEquals('qna', $foundItem->id);
     $this->assertEquals('main', $foundItem->parentId);
     $this->assertEquals(1, $foundItem->ordering);
     $this->assertEquals(true, $foundItem->activated);
     $this->assertEquals('pluginA@board', $foundItem->type);
     $this->assertEquals('Q & A', $foundItem->title);
     $this->assertEquals('질답 게시판입니다.', $foundItem->description);
     $this->assertEquals('qna', $foundItem->url);
 }