3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
37 * Helper authentication class for unit tests
39 class CRM_Utils_System_UnitTests
extends CRM_Utils_System_Drupal
{
40 function __construct() {
41 $this->is_drupal
= FALSE;
42 $this->supports_form_extensions
= False;
45 function setTitle($title, $pageTitle = NULL) {
49 static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
50 $retVal = array(1, 1, 12345);
54 function appendBreadCrumb($breadCrumbs) {
58 function resetBreadCrumb() {
62 function addHTMLHead($head) {
66 function mapConfigToSSL() {
68 $base_url = str_replace('http://', 'https://', $base_url);
71 function postURL($action) {
75 function url($path = NULL, $query = NULL, $absolute = FALSE,
76 $fragment = NULL, $htmlize = TRUE,
77 $frontend = FALSE, $forceBackend = FALSE
79 $config = CRM_Core_Config
::singleton();
80 static $script = 'index.php';
82 if (isset($fragment)) {
83 $fragment = '#' . $fragment;
86 if (!isset($config->useFrameworkRelativeBase
)) {
87 $base = parse_url($config->userFrameworkBaseURL
);
88 $config->useFrameworkRelativeBase
= $base['path'];
90 $base = $absolute ?
$config->userFrameworkBaseURL
: $config->useFrameworkRelativeBase
;
92 $separator = $htmlize ?
'&' : '&';
94 if (!$config->cleanURL
) {
97 return $base . $script . '?q=' . $path . $separator . $query . $fragment;
100 return $base . $script . '?q=' . $path . $fragment;
105 return $base . $script . '?' . $query . $fragment;
108 return $base . $fragment;
115 return $base . $path . '?' . $query . $fragment;
118 return $base . $path . $fragment;
123 return $base . $script . '?' . $query . $fragment;
126 return $base . $fragment;
132 function getUserID($user) {
133 //FIXME: look here a bit closer when testing UFMatch
135 // this puts the appropriate values in the session, so
136 // no need to return anything
137 CRM_Core_BAO_UFMatch
::synchronize($user, TRUE, 'Standalone', 'Individual');
140 function getAllowedToLogin($user) {
144 function setMessage($message) {
148 function permissionDenied() {
149 CRM_Core_Error
::fatal(ts('You do not have permission to access this page'));
154 header("Location:index.php");
157 function getUFLocale() {
161 function getModules() {
166 * Get user login URL for hosting CMS (method declared in each CMS system class)
168 * @param string $destination - if present, add destination to querystring (works for Drupal only)
171 * @return string - loginURL for the current CMS
174 public function getLoginURL($destination = '') {
175 throw new Exception("Method not implemented: getLoginURL");
179 * Over-ridable function to get timezone as a string eg.
180 * @return string Timezone e.g. 'America/Los_Angeles'
182 function getTimeZoneString() {
183 // This class extends Drupal, but we don't want Drupal's behavior; reproduce CRM_Utils_System_Base::getTimeZoneString
184 return date_default_timezone_get();