3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
21 * Helper authentication class for unit tests
23 class CRM_Utils_System_UnitTests
extends CRM_Utils_System_Base
{
27 public function __construct() {
28 $this->is_drupal
= FALSE;
29 $this->supports_form_extensions
= FALSE;
34 * @param string $value
36 public function setHttpHeader($name, $value) {
37 Civi
::$statics[__CLASS__
]['header'][] = ("$name: $value");
43 public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
44 $retVal = [1, 1, 12345];
49 * Bootstrap the phony CMS.
51 public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
58 public function mapConfigToSSL() {
60 $base_url = str_replace('http://', 'https://', $base_url);
66 public function postURL($action) {
79 $forceBackend = FALSE,
82 $config = CRM_Core_Config
::singleton();
83 static $script = 'index.php';
85 if (isset($fragment)) {
86 $fragment = '#' . $fragment;
89 if (!isset($config->useFrameworkRelativeBase
)) {
90 $base = parse_url($config->userFrameworkBaseURL
);
91 $config->useFrameworkRelativeBase
= $base['path'];
93 $base = $absolute ?
$config->userFrameworkBaseURL
: $config->useFrameworkRelativeBase
;
95 $separator = ($htmlize && $frontend) ?
'&' : '&';
97 if (!$config->cleanURL
) {
100 return $base . $script . '?q=' . $path . $separator . $query . $fragment;
103 return $base . $script . '?q=' . $path . $fragment;
108 return $base . $script . '?' . $query . $fragment;
111 return $base . $fragment;
118 return $base . $path . '?' . $query . $fragment;
121 return $base . $path . $fragment;
126 return $base . $script . '?' . $query . $fragment;
129 return $base . $fragment;
138 public function getUserID($user) {
139 //FIXME: look here a bit closer when testing UFMatch
141 // this puts the appropriate values in the session, so
142 // no need to return anything
143 CRM_Core_BAO_UFMatch
::synchronize($user, TRUE, 'Standalone', 'Individual');
149 public function logout() {
151 CRM_Utils_System
::setHttpHeader("Location", "index.php");
157 public function getLoginURL($destination = '') {
158 throw new Exception("Method not implemented: getLoginURL");