/**
  * testGetDefaultAccessPermission
  *
  * @return void
  */
 public function testGetDefaultMenuPermission()
 {
     $permissionHandler = new MenuPermissionHandler($this->permissionFactory, $this->groupRepoMock, $this->memberRepoMock);
     $grant = $permissionHandler->getDefaultMenuPermission();
     $accessKey = Action::ACCESS;
     $visibleKey = Action::VISIBLE;
     $accessGrant = $grant->{$accessKey};
     $visibleGrant = $grant->{$visibleKey};
     $this->assertEquals('guest', $accessGrant['rating']);
     $this->assertEquals([], $accessGrant['group']);
     $this->assertEquals([], $accessGrant['user']);
     $this->assertEquals([], $accessGrant['except']);
     $this->assertEquals('guest', $visibleGrant['rating']);
     $this->assertEquals([], $visibleGrant['group']);
     $this->assertEquals([], $visibleGrant['user']);
     $this->assertEquals([], $visibleGrant['except']);
 }
 /**
  * store
  * 새로운 메뉴 생성을 처리하는 메소드
  *
  * @param MenuAlterHandler      $menuChanger       menu alter handler
  * @param MenuConfigHandler     $configHandler     menu config like theme config handler
  * @param MenuPermissionHandler $permissionHandler menu permission handler
  *
  * @return mixed
  * @throws Exception
  */
 public function store(MenuAlterHandler $menuChanger, MenuConfigHandler $configHandler, MenuPermissionHandler $permissionHandler)
 {
     $inputs = Request::all();
     $selectedDesktopTheme = Request::get('theme_desktop');
     $selectedMobileTheme = Request::get('theme_mobile');
     $rules = ['menuTitle' => 'required', 'theme_desktop' => 'required', 'theme_mobile' => 'required'];
     $validator = Validator::make($inputs, $rules);
     if ($validator->fails()) {
         Request::flash();
         return Redirect::back()->with('alert', ['type' => 'danger', 'message' => $validator->messages()]);
     }
     XeDB::beginTransaction();
     try {
         $menu = $menuChanger->addMenu($inputs);
         $configHandler->setMenuTheme($menu, $selectedDesktopTheme, $selectedMobileTheme);
         $defaultMenuPermission = $permissionHandler->getDefaultMenuPermission();
         $permissionHandler->registerMenuPermission($menu, $defaultMenuPermission);
     } catch (Exception $e) {
         XeDB::rollback();
         Request::flash();
         return Redirect::back()->with('alert', ['type' => 'danger', 'message' => $e->getMessage()]);
     }
     XeDB::commit();
     return Redirect::route('settings.menu.index');
 }