public function testCacheAndGetMungeIdsByUser()
 {
     if (AllPermissionsOptimizationCache::supportsAndAllowsMemcache()) {
         $super = User::getByUsername('super');
         AllPermissionsOptimizationCache::cacheMungeIdsByUser($super, array(3, 4, 5));
         $mungeIds = AllPermissionsOptimizationCache::getMungeIdsByUser($super);
         $this->assertEquals(array(3, 4, 5), $mungeIds);
         $oldValue = Yii::app()->params['showFlashMessageWhenSecurityCacheShouldBeRebuilt'];
         Yii::app()->params['showFlashMessageWhenSecurityCacheShouldBeRebuilt'] = true;
         $this->assertEquals(0, count(Yii::app()->user->getFlashes()));
         AllPermissionsOptimizationCache::forgetAll();
         $this->assertEquals(1, count(Yii::app()->user->getFlashes()));
         Yii::app()->params['showFlashMessageWhenSecurityCacheShouldBeRebuilt'] = false;
         $this->assertEquals(0, count(Yii::app()->user->getFlashes()));
         AllPermissionsOptimizationCache::forgetAll();
         $this->assertEquals(0, count(Yii::app()->user->getFlashes()));
         Yii::app()->params['showFlashMessageWhenSecurityCacheShouldBeRebuilt'] = $oldValue;
         try {
             AllPermissionsOptimizationCache::getMungeIdsByUser($super);
             $this->fail('NotFoundException exception is not thrown.');
         } catch (NotFoundException $e) {
             $this->assertTrue(true);
         }
     }
 }