<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
parent::setUp();
}
- function testLoggingReport() {
+ public function testLoggingReport() {
$this->webtestLogin();
//enable the logging
$this->enableComponents("CiviCase");
//add new contact
- $orginalFirstName = $firstName = 'Anthony' . substr(sha1(rand()), 0, 7);
- $lastName = 'Anderson' . substr(sha1(rand()), 0, 7);
+ $originalFirstName = $firstName = 'Anthony' . substr(sha1(rand()), 0, 7);
+ $lastName = 'Anderson' . substr(sha1(rand()), 0, 7);
$this->webtestAddContact($firstName, $lastName);
$cid = $this->urlArg('cid');
$this->type('subject', $noteSubject);
$this->type('note', $noteText);
$this->click("_qf_Note_upload-top");
- $this->waitForElementPresent("xpath=//div[@id='notes']//a[text()='Edit']");
- $this->click("xpath=//div[@id='notes']//a[text()='Edit']");
-
+ $this->waitForElementPresent("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[1]/a[2][text()='Edit']");
+ $this->click("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[1]/a[2][text()='Edit']");
$this->waitForElementPresent("_qf_Note_upload-top");
$this->type('subject', $noteSubject . "_edited");
$this->type('note', $noteText . "_edited");
$this->clickLink("_qf_Note_upload-top", "xpath=//div[@class='crm-results-block']/div[@id='notes']/div/table/tbody/tr//td/span[2]/ul/li[2]/a[text()='Delete']", FALSE);
- $this->click("xpath=//div[@class='crm-results-block']/div[@id='notes']/div/table/tbody/tr//td/span[2]/ul/li[2]/a[text()='Delete']");
+ $this->click("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[2]/ul/li[2]/a[text()='Delete']");
// Check confirmation alert.
$this->waitForText("xpath=//form[@id='Note']/div[@class='view-content']/div[@class='status']", "Are you sure you want to delete the note ''?");
$this->click("xpath=//input[@id='_qf_Note_next']");
$this->select("relationship_type_id", "label=Employee of");
$this->select2('related_contact_id', 'Default', TRUE);
$this->click('_qf_Relationship_upload-bottom');
- $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
- $this->click("xpath=//div[@class='crm-contact-relationship-current']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
+ $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
+
+ $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
$this->waitForText("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']", 'Are you sure you want to disable this relationship?');
$this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[text()='Yes']");
$this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-past']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[2]/a[text()='Delete']");
$this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[8]/span/a[2]");
$this->click("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[8]/span/a[2]");
$this->waitForElementPresent("_qf_Activity_cancel-bottom");
- $this->select("status_id","value=2");
+ $this->select("status_id", "value=2");
$this->click('_qf_Activity_upload-bottom');
$this->waitForText("crm-notification-container", "Activity has been saved.");
$this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[7][text()='Completed']");
$this->waitForElementPresent("xpath=//div[@class='view-content']//div[@class='action-link']/a");
$this->click("xpath=//div[@class='view-content']//div[@class='action-link']/a");
$this->waitForElementPresent("_qf_Case_cancel-bottom");
- $this->type('activity_subject',"subject".rand());
- $this->select('case_type_id','value=1');
+ $this->type('activity_subject', "subject" . rand());
+ $this->select('case_type_id', 'value=1');
$this->click('_qf_Case_upload-bottom');
- $this->waitForElementPresent("xpath=//div[@class='view-content']/table[@class='caseSelector']/tbody/tr[2]/td[9]//span//a[text()='Manage']");
- $this->click("xpath=//div[@class='view-content']/table[@class='caseSelector']/tbody/tr[2]/td[9]//span//a[text()='Manage']");
+ $this->waitForElementPresent("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']");
+ $this->click("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']");
$this->waitForElementPresent("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a");
$this->click("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a");
$this->waitForElementPresent("_qf_Activity_cancel-bottom");
- $this->select("case_status_id","value=2");
+ $this->select("case_status_id", "value=2");
$this->click("_qf_Activity_upload-top");
$this->waitForElementPresent("_qf_CaseView_cancel-bottom");
$this->click("_qf_CaseView_cancel-bottom");
array("log_type" => "Contact", "altered_contact" => "{$firstName} {$lastName}", "action" => "Update"),
array("log_type" => "Contact", "altered_contact" => "{$firstName} {$lastName}", "action" => "Insert"),
//relationship data check
- array("log_type" => "Relationship", "altered_contact" => "{$firstName} {$lastName} [Employee of]", "action" => "Update"),
- array("log_type" => "Relationship", "altered_contact" => "{$firstName} {$lastName} [Employee of]", "action" => "Insert"),
- array("log_type" => "Relationship", "altered_contact" => "{$firstName} {$lastName} [Employee of]", "action" => "Delete"),
+ array(
+ "log_type" => "Relationship",
+ "altered_contact" => "{$firstName} {$lastName} [Employee of]",
+ "action" => "Update",
+ ),
+ array(
+ "log_type" => "Relationship",
+ "altered_contact" => "{$firstName} {$lastName} [Employee of]",
+ "action" => "Insert",
+ ),
+ array(
+ "log_type" => "Relationship",
+ "altered_contact" => "{$firstName} {$lastName} [Employee of]",
+ "action" => "Delete",
+ ),
//group data check
- array("log_type" => "Group", "altered_contact" => "{$firstName} {$lastName} [Case Resources]", "action" => "Added"),
- array("log_type" => "Group", "altered_contact" => "{$firstName} {$lastName} [Case Resources]", "action" => "Removed"),
+ array(
+ "log_type" => "Group",
+ "altered_contact" => "{$firstName} {$lastName} [Case Resources]",
+ "action" => "Added",
+ ),
+ array(
+ "log_type" => "Group",
+ "altered_contact" => "{$firstName} {$lastName} [Case Resources]",
+ "action" => "Removed",
+ ),
//note data check
array("log_type" => "Note", "altered_contact" => "{$firstName} {$lastName}", "action" => "Update"),
array("log_type" => "Note", "altered_contact" => "{$firstName} {$lastName}", "action" => "Insert"),
array("log_type" => "Note", "altered_contact" => "{$firstName} {$lastName}", "action" => "Delete"),
//tags data check
array("log_type" => "Tag", "altered_contact" => "{$firstName} {$lastName} [Company]", "action" => "Insert"),
- array("log_type" => "Tag", "altered_contact" => "{$firstName} {$lastName} [Government Entity]", "action" => "Insert"),
+ array(
+ "log_type" => "Tag",
+ "altered_contact" => "{$firstName} {$lastName} [Government Entity]",
+ "action" => "Insert",
+ ),
array("log_type" => "Tag", "altered_contact" => "{$firstName} {$lastName} [Company]", "action" => "Delete"),
//case data check
- array("log_type" => "Case", "altered_contact" => "{$firstName} {$lastName} [Housing Support]", "action" => "Update"),
- array("log_type" => "Case", "altered_contact" => "{$firstName} {$lastName} [Housing Support]", "action" => "Insert"),
+ array(
+ "log_type" => "Case",
+ "altered_contact" => "{$firstName} {$lastName} [Housing Support]",
+ "action" => "Update",
+ ),
+ array(
+ "log_type" => "Case",
+ "altered_contact" => "{$firstName} {$lastName} [Housing Support]",
+ "action" => "Insert",
+ ),
//case activity check
- array("log_type" => "Activity", "altered_contact" => "{$firstName} {$lastName} [Interview]", "action" => "Update"),
- array("log_type" => "Activity", "altered_contact" => "{$firstName} {$lastName} [Interview]", "action" => "Insert"),
+ array(
+ "log_type" => "Activity",
+ "altered_contact" => "{$firstName} {$lastName} [Interview]",
+ "action" => "Update",
+ ),
+ array(
+ "log_type" => "Activity",
+ "altered_contact" => "{$firstName} {$lastName} [Interview]",
+ "action" => "Insert",
+ ),
);
$this->verifyReportData($data);
//update link (logging details report check)
$contactInfo = array();
$contactInfo['data'] = array(
- array('field' => 'Sort Name', 'changed_from' => "{$lastName}, {$orginalFirstName}", 'changed_to' => "{$lastName}, {$firstName}"),
- array('field' => 'Display Name', 'changed_from' => "{$orginalFirstName} {$lastName}", 'changed_to' => "{$firstName} {$lastName}"),
- array('field' => 'First Name', 'changed_from' => $orginalFirstName, 'changed_to' => $firstName),
- // array('field' => 'Email Greeting', 'changed_from' => "Dear {$orginalFirstName}", 'changed_to' => "Dear {$firstName}"),
- // array('field' => 'Postal Greeting', 'changed_from' => "Dear {$orginalFirstName}", 'changed_to' => "Dear {$firstName}"),
- // array('field' => 'Addressee', 'changed_from' => "{$orginalFirstName} {$lastName}", 'changed_to' => "{$firstName} {$lastName}"),
+ array(
+ 'field' => 'Sort Name',
+ 'changed_from' => "{$lastName}, {$originalFirstName}",
+ 'changed_to' => "{$lastName}, {$firstName}",
+ ),
+ array(
+ 'field' => 'Display Name',
+ 'changed_from' => "{$originalFirstName} {$lastName}",
+ 'changed_to' => "{$firstName} {$lastName}",
+ ),
+ array('field' => 'First Name', 'changed_from' => $originalFirstName, 'changed_to' => $firstName),
+ // array('field' => 'Email Greeting', 'changed_from' => "Dear {$originalFirstName}", 'changed_to' => "Dear {$firstName}"),
+ // array('field' => 'Postal Greeting', 'changed_from' => "Dear {$originalFirstName}", 'changed_to' => "Dear {$firstName}"),
+ // array('field' => 'Addressee', 'changed_from' => "{$originalFirstName} {$lastName}", 'changed_to' => "{$firstName} {$lastName}"),
);
$contactInfo = array_merge($contactInfo, $data[0]);
$relationshipInfo = array();
$relationshipInfo['data'] = array(
- array('field' => 'Relationship Is Active', 'changed_from' => 'true', 'changed_to' => 'false')
+ array('field' => 'Relationship Is Active', 'changed_from' => 'true', 'changed_to' => 'false'),
);
$relationshipInfo = array_merge($relationshipInfo, $data[2]);
$activityInfo = array();
$activityInfo['data'] = array(
- array('field' => 'Activity Status Id', 'changed_from' => 'Scheduled', 'changed_to' => 'Completed'),
- );
+ array('field' => 'Activity Status Id', 'changed_from' => 'Scheduled', 'changed_to' => 'Completed'),
+ );
$activityInfo = array_merge($activityInfo, $data[15]);
$dataForReportDetail = array($contactInfo, $relationshipInfo, $noteInfo, $caseInfo, $activityInfo);
$this->click("_qf_LoggingSummary_submit");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $contactDataDelete = array(array("log_type" => "Contact", "altered_contact" => "{$firstName} {$lastName}", "action" => "Delete (to trash)"));
+ $contactDataDelete = array(
+ array(
+ "log_type" => "Contact",
+ "altered_contact" => "{$firstName} {$lastName}",
+ "action" => "Delete (to trash)",
+ ),
+ );
$this->verifyReportData($contactDataDelete);
//disable the logging
$this->openCiviPage('admin/setting/misc', 'reset=1');
+ $this->waitForElementPresent("xpath=//tr[@class='crm-miscellaneous-form-block-logging']/td[2]/label[text()='No']");
$this->click("xpath=//tr[@class='crm-miscellaneous-form-block-logging']/td[2]/label[text()='No']");
$this->click("_qf_Miscellaneous_next-top");
$this->waitForTextPresent("Changes Saved");
/**
* @param $data
*/
- function verifyReportData($data) {
+ public function verifyReportData($data) {
foreach ($data as $value) {
// check for the row contains proper data
$actionPath = ($value['action'] == 'Update') ? "td[1]/a[2]" : "td[1][contains(text(), '{$value['action']}')]";
$this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../{$contactCheck}/../{$actionPath}"), "The proper record not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']}, action as {$value['action']})");
if ($value['action'] == 'Update') {
- $this->assertTrue( ($value['action'] == $this->getText("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../{$actionPath}")), "The proper record action {$value['action']} not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']} record)");
+ $this->assertTrue(($value['action'] == $this->getText("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../{$actionPath}")), "The proper record action {$value['action']} not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']} record)");
}
}
}
* @param $dataForReportDetail
* @param array $filters
*/
- function detailReportCheck($dataForReportDetail, $filters = array()) {
+ public function detailReportCheck($dataForReportDetail, $filters = array()) {
foreach ($dataForReportDetail as $value) {
$this->waitForElementPresent("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../td[1]/a[2]");
$this->click("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../td[1]/a[2]");
}
}
- //visit the logging contact summary report
- $this->openCiviPage('report/logging/contact/summary', 'reset=1');
- foreach ($filters as $type => $filter) {
- if ($type == 'text' ) {
- foreach ($filter as $filterName => $filterValue) {
- $this->type($filterName, $filterValue);
+ //visit the logging contact summary report
+ $this->openCiviPage('report/logging/contact/summary', 'reset=1');
+ foreach ($filters as $type => $filter) {
+ if ($type == 'text') {
+ foreach ($filter as $filterName => $filterValue) {
+ $this->type($filterName, $filterValue);
+ }
}
}
- }
- $this->click("_qf_LoggingSummary_submit");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->click("_qf_LoggingSummary_submit");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
}
}
}