tidy-up - remove duplicate array keys
[civicrm-core.git] / tests / phpunit / WebTest / Contribute / OfflineRecurContributionTest.php
index 2177080a55c01c6761a4a394ac61d0201593fe10..c7633a30d5204717981dfdd16d2568bcfa2c2c2a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 */
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Contribute_OfflineRecurContributionTest
+ */
 class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCase {
 
   protected function setUp() {
     parent::setUp();
   }
 
-  function testOfflineRecurContribution() {
+  public function testOfflineRecurContribution() {
     $this->webtestLogin();
 
     // We need a payment processor
@@ -39,20 +43,17 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa
     $this->webtestAddPaymentProcessor($processorName, 'AuthNet');
 
     // create a new contact for whom recurring contribution is to be created
-    $firstName  = 'Jane' . substr(sha1(rand()), 0, 7);
+    $firstName = 'Jane' . substr(sha1(rand()), 0, 7);
     $middleName = 'Middle';
-    $lastName   = 'Recuroff_' . substr(sha1(rand()), 0, 7);
+    $lastName = 'Recuroff_' . substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName, $lastName, "{$firstName}@example.com");
     $contactName = "$firstName $lastName";
 
     $this->click('css=li#tab_contribute a');
 
     $this->waitForElementPresent('link=Submit Credit Card Contribution');
-    $this->click('link=Submit Credit Card Contribution');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
     // since we don't have live credentials we will switch to test mode
-    $url = $this->getLocation();
+    $url = $this->getAttribute("xpath=//*[@id='Search']//a[text()='Submit Credit Card Contribution']@href");
     $url = str_replace('mode=live', 'mode=test', $url);
     $this->open($url);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -61,8 +62,8 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa
     $this->waitForElementPresent('payment_processor_id');
     $this->select('payment_processor_id', "label={$processorName}");
 
-      $this->click('financial_type_id');
-      $this->select('financial_type_id', 'label=Donation');
+    $this->click('financial_type_id');
+    $this->select('financial_type_id', 'label=Donation');
     $this->type('total_amount', '10');
 
     // recurring contribution fields
@@ -72,7 +73,7 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa
     $this->type('installments', '12');
 
     $this->click('is_email_receipt');
-      $this->waitForElementPresent('credit_card_type');
+    $this->waitForElementPresent('credit_card_type');
 
     // enter credit card info on form
     $this->webtestAddCreditCardDetails();
@@ -80,7 +81,8 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa
     // billing address
     $this->webtestAddBillingDetails($firstName, $middleName, $lastName);
     $this->click('_qf_Contribution_upload-bottom');
-
+    $this->waitForElementPresent('link=Edit');
+    $this->waitForText('crm-notification-container', "The contribution record has been processed.");
     // Use Find Contributions to make sure test recurring contribution exists
     $this->openCiviPage("contribute/search", "reset=1", 'contribution_currency_type');
 
@@ -95,7 +97,7 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa
     // View Recurring Contribution Record
     $verifyData = array(
       'From' => "$contactName",
-                          'Financial Type'    => 'Donation (test)',
+      'Financial Type' => 'Donation (test)',
       'Total Amount' => 'Installments: 12, Interval: 1 month(s)',
       'Contribution Status' => 'Pending : Incomplete Transaction',
       'Paid By' => 'Credit Card',
@@ -108,4 +110,3 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa
     }
   }
 }
-