3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
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-2019
37 * Helper authentication class for unit tests
39 class CRM_Utils_System_UnitTests
extends CRM_Utils_System_Base
{
43 public function __construct() {
44 $this->is_drupal
= FALSE;
45 $this->supports_form_extensions
= FALSE;
51 public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
52 $retVal = [1, 1, 12345];
57 * Bootstrap the phony CMS.
59 public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
66 public function mapConfigToSSL() {
68 $base_url = str_replace('http://', 'https://', $base_url);
74 public function postURL($action) {
90 $config = CRM_Core_Config
::singleton();
91 static $script = 'index.php';
93 if (isset($fragment)) {
94 $fragment = '#' . $fragment;
97 if (!isset($config->useFrameworkRelativeBase
)) {
98 $base = parse_url($config->userFrameworkBaseURL
);
99 $config->useFrameworkRelativeBase
= $base['path'];
101 $base = $absolute ?
$config->userFrameworkBaseURL
: $config->useFrameworkRelativeBase
;
103 $separator = $htmlize ?
'&' : '&';
105 if (!$config->cleanURL
) {
108 return $base . $script . '?q=' . $path . $separator . $query . $fragment;
111 return $base . $script . '?q=' . $path . $fragment;
116 return $base . $script . '?' . $query . $fragment;
119 return $base . $fragment;
126 return $base . $path . '?' . $query . $fragment;
129 return $base . $path . $fragment;
134 return $base . $script . '?' . $query . $fragment;
137 return $base . $fragment;
146 public function getUserID($user) {
147 //FIXME: look here a bit closer when testing UFMatch
149 // this puts the appropriate values in the session, so
150 // no need to return anything
151 CRM_Core_BAO_UFMatch
::synchronize($user, TRUE, 'Standalone', 'Individual');
157 public function logout() {
159 CRM_Utils_System
::setHttpHeader("Location", "index.php");
165 public function getLoginURL($destination = '') {
166 throw new Exception("Method not implemented: getLoginURL");