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
19 * Helper authentication class for unit tests
21 class CRM_Utils_System_UnitTests
extends CRM_Utils_System_Base
{
25 public function __construct() {
26 $this->is_drupal
= FALSE;
27 $this->supports_form_extensions
= FALSE;
32 * @param string $value
34 public function setHttpHeader($name, $value) {
35 Civi
::$statics[__CLASS__
]['header'][] = ("$name: $value");
41 public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
42 $retVal = [1, 1, 12345];
47 * Bootstrap the phony CMS.
49 public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
56 public function mapConfigToSSL() {
58 $base_url = str_replace('http://', 'https://', $base_url);
64 public function postURL($action) {
77 $forceBackend = FALSE,
80 $config = CRM_Core_Config
::singleton();
81 static $script = 'index.php';
83 if (isset($fragment)) {
84 $fragment = '#' . $fragment;
87 if (!isset($config->useFrameworkRelativeBase
)) {
88 $base = parse_url($config->userFrameworkBaseURL
);
89 $config->useFrameworkRelativeBase
= $base['path'];
91 $base = $absolute ?
$config->userFrameworkBaseURL
: $config->useFrameworkRelativeBase
;
93 $separator = ($htmlize && $frontend) ?
'&' : '&';
95 if (!$config->cleanURL
) {
98 return $base . $script . '?q=' . $path . $separator . $query . $fragment;
101 return $base . $script . '?q=' . $path . $fragment;
106 return $base . $script . '?' . $query . $fragment;
109 return $base . $fragment;
116 return $base . $path . '?' . $query . $fragment;
119 return $base . $path . $fragment;
124 return $base . $script . '?' . $query . $fragment;
127 return $base . $fragment;
136 public function getUserID($user) {
137 //FIXME: look here a bit closer when testing UFMatch
139 // this puts the appropriate values in the session, so
140 // no need to return anything
141 CRM_Core_BAO_UFMatch
::synchronize($user, TRUE, 'Standalone', 'Individual');
147 public function logout() {
149 CRM_Utils_System
::setHttpHeader("Location", "index.php");
155 public function getLoginURL($destination = '') {
156 throw new Exception("Method not implemented: getLoginURL");