version fixes
[civicrm-core.git] / tests / phpunit / WebTest / Member / OnlineAutoRenewMembershipTest.php
index ea520a2bd65f31504b7919dea0c04a70bb268e9e..88e05a8096bcf3e4612f8189af466d39f0a4b5be 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -22,7 +22,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
 
@@ -35,14 +35,14 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
     parent::setUp();
   }
 
-  function testOnlineAutoRenewMembershipAnonymous() {
+  public function testOnlineAutoRenewMembershipAnonymous() {
     //configure membership signup page.
     $pageId = $this->_configureMembershipPage();
 
     //now do the test membership signup.
     $this->openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom");
 
-    $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]");
+    $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div[2]/span/label/span[1][contains(text(),'Student')]");
 
     $this->click("auto_renew");
 
@@ -55,16 +55,16 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
     $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
 
     $text = 'I want this membership to be renewed automatically every 1 year(s).';
-    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text);
+    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]/strong[2]", $text, 'Missing text: ' . $text);
 
     $this->click("_qf_Confirm_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $text = 'This membership will be renewed automatically every 1 year(s).';
-    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text);
+    $text = 'This membership will be renewed automatically every year.';
+    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]/strong[3]", $text, 'Missing text: ' . $text);
   }
 
-  function testOnlineAutoRenewMembershipAuthenticated() {
+  public function testOnlineAutoRenewMembershipAuthenticated() {
     //configure membership signup page.
     $pageId = $this->_configureMembershipPage();
 
@@ -74,7 +74,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
     //now do the test membership signup.
     $this->openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom");
 
-    $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]");
+    $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div[2]/span/label/span[1][contains(text(),'Student')]");
 
     $this->click("auto_renew");
 
@@ -88,23 +88,23 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
     $this->waitForElementPresent("_qf_Confirm_next-bottom");
 
     $text = 'I want this membership to be renewed automatically every 1 year(s).';
-    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text);
+    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]/strong[2]", $text, 'Missing text: ' . $text);
 
     $this->click("_qf_Confirm_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $text = 'This membership will be renewed automatically every 1 year(s).';
-    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text);
+    $text = 'This membership will be renewed automatically every year.';
+    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]/strong[3]", $text, 'Missing text: ' . $text);
   }
 
-  function testOnlinePendingAutoRenewMembershipAnonymous() {
+  public function testOnlinePendingAutoRenewMembershipAnonymous() {
     //configure membership signup page.
     $pageId = $this->_configureMembershipPage();
 
     //now do the test membership signup.
     $this->openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom");
 
-    $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]");
+    $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div[2]/span/label/span[1][contains(text(),'Student')]");
 
     $this->click("auto_renew");
 
@@ -116,23 +116,23 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
     $this->waitForElementPresent("_qf_Confirm_next-bottom");
 
     $text = 'I want this membership to be renewed automatically every 1 year(s).';
-    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text);
+    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]/strong[2]", $text, 'Missing text: ' . $text);
 
     $this->click("_qf_Confirm_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $text = 'This membership will be renewed automatically every 1 year(s).';
-    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text);
+    $text = 'This membership will be renewed automatically every year.';
+    $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]/strong[3]", $text, 'Missing text: ' . $text);
   }
 
   /**
    * @return null
    */
-  function _configureMembershipPage() {
+  public function _configureMembershipPage() {
     static $pageId = NULL;
 
     if (!$pageId) {
-        $this->webtestLogin();
+      $this->webtestLogin();
 
       //add payment processor.
       $hash = substr(sha1(rand()), 0, 7);
@@ -148,7 +148,6 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
       $this->type("duration_interval", "1");
       $this->select("duration_unit", "label=year");
 
-
       $this->click("_qf_MembershipType_upload-bottom");
       $this->waitForPageToLoad($this->getTimeoutMsec());
 
@@ -159,7 +158,6 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
       $this->type("duration_interval", "1");
       $this->select("duration_unit", "label=year");
 
-
       $this->click("_qf_MembershipType_upload-bottom");
       $this->waitForPageToLoad($this->getTimeoutMsec());
 
@@ -169,7 +167,8 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
       $onBehalf = FALSE;
       $pledges = FALSE;
       $recurring = TRUE;
-      $membershipTypes = array(array('id' => 1, 'auto_renew' => 1),
+      $membershipTypes = array(
+        array('id' => 1, 'auto_renew' => 1),
         array('id' => 2, 'auto_renew' => 1),
       );
       $memPriceSetId = NULL;
@@ -202,7 +201,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
       );
 
       //make sure we do have required permissions.
-      $permissions = array("edit-1-make-online-contributions",  "edit-1-profile-listings-and-forms");
+      $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms");
       $this->changePermissions($permissions);
 
       // now logout and do membership test that way
@@ -211,5 +210,5 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase
 
     return $pageId;
   }
-}
 
+}