static function setCache($values, $group, $componentID = NULL, $contactID = NULL)
 {
     if (!isset(self::$_cache)) {
         self::$_cache = array();
     }
     $cacheKey = "CRM_Setting_{$group}_{$componentID}_{$contactID}";
     self::$_cache[$cacheKey] = $values;
     $globalCache = CRM_Utils_Cache::singleton();
     $result = $globalCache->set($cacheKey, $values);
     return $cacheKey;
 }
 /**
  * Temporarily alter the settings-metadata to add a mock setting.
  *
  * WARNING: The setting metadata will disappear on the next cache-clear.
  *
  * @param $extras
  * @return void
  */
 public function setMockSettingsMetaData($extras)
 {
     CRM_Core_BAO_Setting::$_cache = array();
     $this->callAPISuccess('system', 'flush', array());
     CRM_Core_BAO_Setting::$_cache = array();
     CRM_Utils_Hook::singleton()->setHook('civicrm_alterSettingsMetaData', function (&$metadata, $domainId, $profile) use($extras) {
         $metadata = array_merge($metadata, $extras);
     });
     $fields = $this->callAPISuccess('setting', 'getfields', array());
     foreach ($extras as $key => $spec) {
         $this->assertNotEmpty($spec['title']);
         $this->assertEquals($spec['title'], $fields['values'][$key]['title']);
     }
 }