Commit | Line | Data |
---|---|---|
862dad2c TO |
1 | <?php |
2 | ||
3 | /** | |
4 | * This is a variant of CiviSeleniumSettings which autopopulates | |
5 | * using data from $_ENV. | |
6 | */ | |
7 | class CiviSeleniumSettings { | |
8 | public $publicSandbox = FALSE; | |
9 | public $browser = '*firefox'; | |
10 | public $sandboxURL; | |
11 | public $sandboxPATH; | |
12 | public $username; | |
13 | public $password; | |
14 | public $adminUsername; | |
15 | public $adminPassword; | |
16 | public $adminApiKey; | |
17 | public $siteKey; | |
18 | public $UFemail = 'noreply@civicrm.org'; | |
19 | public $cookies; | |
20 | ||
21 | public function __construct() { | |
22 | $required = array(); | |
23 | foreach (array('CMS_URL', 'ADMIN_USER', 'ADMIN_PASS', 'DEMO_USER', 'DEMO_PASS') as $key) { | |
24 | if (empty($GLOBALS['_CV'][$key])) { | |
25 | $required[] = $key; | |
26 | } | |
27 | } | |
28 | if (!empty($required)) { | |
29 | throw new RuntimeException("CiviSeleniumSettings failed to find required values from cv: " | |
30 | . implode(' ', $required)); | |
31 | } | |
32 | ||
33 | $path = parse_url($GLOBALS['_CV']['CMS_URL'], PHP_URL_PATH); | |
34 | $this->sandboxURL = substr($GLOBALS['_CV']['CMS_URL'], 0, strlen($GLOBALS['_CV']['CMS_URL']) - strlen($path)); | |
35 | $this->sandboxPATH = $path; | |
36 | $this->fullSandboxPath = $GLOBALS['_CV']['CMS_URL']; | |
37 | $this->adminUsername = $GLOBALS['_CV']['ADMIN_USER']; | |
38 | $this->adminPassword = $GLOBALS['_CV']['ADMIN_PASS']; | |
39 | $this->username = $GLOBALS['_CV']['DEMO_USER']; | |
40 | $this->password = $GLOBALS['_CV']['DEMO_PASS']; | |
41 | $this->siteKey = CIVICRM_SITE_KEY; | |
42 | $this->adminApiKey = md5('apikeyadmin' . $GLOBALS['_CV']['CMS_DB_DSN'] . CIVICRM_SITE_KEY); | |
43 | $this->cookies = array(); | |
44 | } | |
45 | ||
46 | // /** | |
47 | // * @return array | |
48 | // */ | |
49 | // function createConstCookie() { | |
50 | // global $civibuild; | |
51 | // $now = time(); | |
52 | // $civiConsts = array( | |
53 | // 'CIVICRM_DSN' => CIVICRM_DSN, | |
54 | // 'CIVICRM_UF_DSN' => CIVICRM_UF_DSN, | |
55 | // 'ts' => $now, | |
56 | // 'sig' => md5(implode(';;', array(CIVICRM_DSN, CIVICRM_UF_DSN, $civibuild['SITE_TOKEN'], $now))), | |
57 | // ); | |
58 | // | |
59 | // return array( | |
60 | // 'name' => 'civiConsts', | |
61 | // 'value' => urlencode(json_encode($civiConsts)), | |
62 | // ); | |
63 | // } | |
64 | ||
65 | } |