add missing comments - tests directory
[civicrm-core.git] / tests / phpunit / WebTest / Case / CaseCustomFieldsTest.php
index 42322a1d680e3c9268a8c591a5555d477f4c08ab..4a64a1460367ab1a1a177c2a841a7ff96fde6095 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -91,7 +91,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $custFname = "Mike" . substr(sha1(rand()), 0, 7);
     $custMname = "Dav" . substr(sha1(rand()), 0, 7);
     $custLname = "Krist" . substr(sha1(rand()), 0, 7);
-    $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4);
+    $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
 
     // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
     $caseTypeLabel = "Adult Day Care Referral";
@@ -132,7 +132,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->openCiviPage('case', 'reset=1', "xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']");
     $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']");
-    $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
+    $this->waitForElementPresent("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']");
     // Because it tends to cause problems, all uses of sleep() must be justified in comments
     // Sleep should never be used for wait for anything to load from the server
     // Justification for this instance: FIXME
@@ -151,7 +151,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
       "Priority" => "Normal",
     );
     $this->webtestVerifyTabularData($openCaseData);
-    $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
+    $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']");
 
     // verify if custom data is present
     $this->openCiviPage('case', 'reset=1');
@@ -196,7 +196,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
       "Priority" => "Normal",
     );
     $this->webtestVerifyTabularData($openCaseChangeData);
-    $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
+    $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']");
     // Because it tends to cause problems, all uses of sleep() must be justified in comments
     // Sleep should never be used for wait for anything to load from the server
     // Justification for this instance: FIXME
@@ -205,6 +205,10 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $this->_testDeleteCustomData($customGrpId1, $customId);
   }
 
+  /**
+   * @param $validateStrings
+   * @param $activityTypes
+   */
   function _testVerifyCaseSummary($validateStrings, $activityTypes) {
     $this->assertStringsPresent($validateStrings);
     foreach ($activityTypes as $aType) {
@@ -214,6 +218,12 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $this->assertElementPresent("name=case_report_all", "Print Case Summary button is missing.");
   }
 
+  /**
+   * @param $customGrpId1
+   * @param bool $noteRichEditor
+   *
+   * @return array
+   */
   function _testGetCustomFieldId($customGrpId1, $noteRichEditor=FALSE) {
     $customId = array();
 
@@ -285,6 +295,10 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     return $customId;
   }
 
+  /**
+   * @param $customGrpId1
+   * @param $customId
+   */
   function _testDeleteCustomData($customGrpId1, $customId) {
     // delete all custom data
     foreach ($customId as $cKey => $cValue) {
@@ -357,7 +371,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $email = "{$lastName}.{$firstName}@example.org";
     $custFname = "Mike" . substr(sha1(rand()), 0, 7);
     $custLname = "Krist" . substr(sha1(rand()), 0, 7);
-    $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4);
+    $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
 
     // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
     $caseTypeLabel = "Adult Day Care Referral";
@@ -395,7 +409,6 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']");
 
     $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']");
-    $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
 
     $openCaseData = array(
       "Client" => $displayName,
@@ -414,7 +427,6 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
       $this->waitForElementPresent("xpath=//table/tbody/tr/td[text()='{$label}']/following-sibling::td");
     }
     $this->webtestVerifyTabularData($openCaseData);
-    $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
 
     // verify if custom data is present
     $this->openCiviPage('case', 'reset=1');
@@ -424,12 +436,9 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
 
     $cusId_1 = 'custom_' . $customId[0] . '_1';
     $cusId_2 = 'custom_' . $customId[1] . '_1';
-    $this->click("css=#{$customGrp1} a.button");
+    $this->clickLink("css=#{$customGrp1} a.button");
 
-    // wait for dialog element
-    $this->waitForElementPresent("css=div.ui-dialog div.ui-dialog-titlebar");
-    // check for dialog box Title
-    $this->assertElementContainsText("css=div.ui-dialog div.ui-dialog-titlebar", 'Update Case Information');
+    $this->assertElementContainsText("page-title", "Edit $customGrp1");
 
     $custFname = "Miky" . substr(sha1(rand()), 0, 7);
     $custLname = "Kristy" . substr(sha1(rand()), 0, 7);
@@ -444,6 +453,12 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $this->_testDeleteCustomData($customGrpId1, $customId);
   }
 
+  /**
+   * @param $customId
+   * @param $custFname
+   * @param $custMname
+   * @param $custLname
+   */
   function _testAdvansearchCaseData($customId, $custFname, $custMname, $custLname) {
     // search casecontact
     $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');