/**
  * testFindMenuByItemId
  *
  * @return void
  */
 public function testFindMenuByItemId()
 {
     $conn = $this->getConnectionMock();
     $keygen = $this->getKeygenMock();
     $repoInstance = new DBMenuRepository($conn, $keygen);
     $menuTableQuery = $this->getQueryBuilderMock();
     $itemTableQuery = $this->getQueryBuilderMock();
     $nodeTableQuery = $this->getQueryBuilderMock();
     $conn->shouldReceive('table')->with(self::MENU_TABLE)->andReturn($menuTableQuery);
     $menuTableQuery->shouldReceive('where')->withAnyArgs()->andReturn($menuTableQuery);
     $menuTableQuery->shouldReceive('first')->withAnyArgs()->andReturn(['id' => 'main', 'title' => '기본메뉴', 'description' => '기본메뉴입니다.']);
     $conn->shouldReceive('table')->with(self::MENU_ITEM_TABLE . ' as t')->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('selectRaw')->withAnyArgs()->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('join')->withAnyArgs()->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('where')->withAnyArgs()->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('where')->withAnyArgs()->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('groupBy')->withAnyArgs()->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('orderBy')->withAnyArgs()->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('get')->withAnyArgs()->andReturn(new Collection([0 => ["id" => "aboutUs", "menuId" => "main", "parentId" => "main", "title" => " 소개", "url" => "aboutUs", "description" => "ddd", "target" => "_self", "type" => "pluginB@page", "ordering" => 0, "activated" => 1, "options" => "", "depth" => 1, "breadcrumbs" => "main,aboutUs"], 1 => ["id" => "freeboard", "menuId" => "main", "parentId" => "main", "title" => "자유게시판", "url" => "freeboard", "description" => "", "target" => "_self", "type" => "pluginA@board", "ordering" => 0, "activated" => 1, "options" => "", "depth" => 1, "breadcrumbs" => "main,freeboard"], 2 => ["id" => "test", "menuId" => "main", "parentId" => "freeboard", "title" => "test", "url" => "test", "description" => "test", "target" => "_self", "type" => "pluginB@widgetPage", "ordering" => 0, "activated" => 1, "options" => "", "depth" => 2, "breadcrumbs" => "main,freeboard,test"], 3 => ["id" => "notice", "menuId" => "main", "parentId" => "main", "title" => "공지 게시판", "url" => "notice", "description" => "공지사항 게시판입니다.", "target" => "_self", "type" => "pluginA@board", "ordering" => 1, "activated" => 1, "options" => "", "depth" => 1, "breadcrumbs" => "main,notice"]]));
     $conn->shouldReceive('table')->with(self::MENU_ITEM_TABLE)->andReturn($itemTableQuery);
     $itemTableQuery->shouldReceive('where')->andReturn($itemTableQuery);
     $itemTableQuery->shouldReceive('select')->andReturn($itemTableQuery);
     $itemTableQuery->shouldReceive('first')->andReturn(['menuId' => 'main']);
     $conn->shouldReceive('table')->with(self::MENU_TREE_PATH_TABLE)->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('where')->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('orderBy')->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('select')->andReturn($nodeTableQuery);
     $nodeTableQuery->shouldReceive('first')->andReturn(['ancestor' => 'main']);
     $menuInstance = $repoInstance->findMenuByItem('notice');
     $this->assertEquals('main', $menuInstance->id);
     $this->assertEquals('기본메뉴', $menuInstance->title);
     $this->assertEquals('기본메뉴입니다.', $menuInstance->description);
     $noticeItem = $menuInstance->getItem('notice');
     $this->assertEquals('notice', $noticeItem->id);
     $this->assertEquals('main', $noticeItem->parentId);
     $this->assertEquals(1, $noticeItem->ordering);
     $this->assertEquals(true, $noticeItem->activated);
     $this->assertEquals('pluginA@board', $noticeItem->type);
     $this->assertEquals('공지사항 게시판입니다.', $noticeItem->description);
     $this->assertEquals('notice', $noticeItem->url);
 }