//URL should eventually be adapted for multisite
$this->url = "{$this->settings->sandboxURL}/{$this->sboxPath}sites/all/modules/civicrm/extern/rest.php";
+ if (!property_exists($this->settings, 'siteKey') || empty($this->settings->siteKey)){
+ $this->markTestSkipped('CiviSeleniumSettings is missing siteKey');
+ }
+
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"q" => "civicrm/login",
}
function testValidLoginCMSUser() {
- if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"q" => "civicrm/login",
$result = json_decode($data, TRUE);
$this->assertNotNull($result);
$this->assertAPIErrorCode($result, 0);
- }
}
function testInvalidPasswordLogin() {
- if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){
$client = CRM_Utils_HttpClient::singleton();
$badPassword = $this->settings->adminPassword . "badpass";
$params = array(
$result = json_decode($data, TRUE);
$this->assertNotNull($result);
$this->assertAPIErrorCode($result, 1);
- }
}
function testValidCallsiteKey() {
- if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"entity" => "Contact",
$result = json_decode($data, TRUE);
$this->assertNotNull($result);
$this->assertAPIErrorCode($result, 0);
- }
}
function testValidCallPHPSessionID() {
- if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"entity" => "Contact",
$result = json_decode($data, TRUE);
$this->assertNotNull($result);
$this->assertAPIErrorCode($result, 0);
-
- }
}
function testInvalidAPIKey() {
- if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"entity" => "Contact",
$result = json_decode($data, TRUE);
$this->assertNotNull($result);
$this->assertAPIErrorCode($result, 1);
- }
}
function testNotCMSUser() {
- if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){
$client = CRM_Utils_HttpClient::singleton();
//Create contact with api_key
$test_key = "testing1234";
$result = json_decode($data, TRUE);
$this->assertNotNull($result);
$this->assertAPIErrorCode($result, 1);
- }
}
}