CRM-12595 fix formatting in tests files
[civicrm-core.git] / tests / phpunit / WebTest / Financial / FinancialBatchExport.php
index 565f4197c47543dee58718b24c0c02c4f8b57f1e..457288430ecdbd73a319d9e15c49ab7a77730616 100644 (file)
-<?php\r
-/*\r
- +--------------------------------------------------------------------+\r
- | CiviCRM version 4.3                                                |\r
- +--------------------------------------------------------------------+\r
- | Copyright CiviCRM LLC (c) 2004-2013                                |\r
- +--------------------------------------------------------------------+\r
- | This file is a part of CiviCRM.                                    |\r
- |                                                                    |\r
- | CiviCRM is free software; you can copy, modify, and distribute it  |\r
- | under the terms of the GNU Affero General Public License           |\r
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |\r
- |                                                                    |\r
- | CiviCRM is distributed in the hope that it will be useful, but     |\r
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |\r
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |\r
- | See the GNU Affero General Public License for more details.        |\r
- |                                                                    |\r
- | You should have received a copy of the GNU Affero General Public   |\r
- | License along with this program; if not, contact CiviCRM LLC       |\r
- | at info[AT]civicrm[DOT]org. If you have questions about the        |\r
- | GNU Affero General Public License or the licensing of CiviCRM,     |\r
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |\r
- +--------------------------------------------------------------------+\r
-*/\r
-\r
-\r
-require_once 'CiviTest/CiviSeleniumTestCase.php';\r
-class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase {\r
-\r
-  protected function setUp() {\r
-    parent::setUp();\r
-  }\r
-\r
-  function testAddFinancialBatch() {\r
-    // Log in using webtestLogin() method\r
-    $this->webtestLogin('admin');\r
-    $this->openCiviPage("financial/batch", "reset=1&action=add", '_qf_FinancialBatch_next-botttom');\r
-    $setTitle = 'Batch ' . substr(sha1(rand()), 0, 7) . date('Y-m-d');\r
-    $setDescription  = 'Test Batch Creation';\r
-    $setPaymentInstrument = 'Credit Card';\r
-    $numberOfTrxn = '10'; // can be 10, 25, 50, 100\r
-    $totalAmt = '1000';\r
-    $exportFormat = 'CSV';\r
-    $batchId = $this->_testAddBatch(\r
-      $setTitle,\r
-      $setDescription,\r
-      $setPaymentInstrument,\r
-      $numberOfTrxn,\r
-      $totalAmt\r
-    );\r
-    $this->_testAssignBatch($numberOfTrxn);\r
-    $this->_testExportBatch($setTitle, $batchId, $exportFormat);\r
-  }\r
-\r
-  function _testAddBatch($setTitle, $setDescription, $setPaymentInstrument, $numberOfTrxn, $totalAmt) {\r
-    // Enter Optional Constraints\r
-    $this->type('title', $setTitle);\r
-    $this->type('description', $setDescription);\r
-    if ($setPaymentInstrument == 'Credit Card') {\r
-      $this->select("payment_instrument_id", "value=1");\r
-    }\r
-    elseif ($setPaymentInstrument == 'Debit Card') {\r
-      $this->select("payment_instrument_id", "value=2");\r
-    }\r
-    elseif ($setPaymentInstrument == 'Cash') {\r
-      $this->select("payment_instrument_id", "value=3");\r
-    }\r
-    elseif ($setPaymentInstrument == 'Check') {\r
-      $this->select("payment_instrument_id", "value=4");\r
-    }\r
-    elseif ($setPaymentInstrument == 'EFT') {\r
-      $this->select("payment_instrument_id", "value=5");\r
-    }\r
-    $this->type('item_count', $numberOfTrxn);\r
-    $this->type('total', $totalAmt);\r
-\r
-    $this->click('_qf_FinancialBatch_next-botttom');\r
-    $this->waitForPageToLoad($this->getTimeoutMsec());\r
-\r
-    // parse URL to grab the batch ID\r
-    $batchId = $this->urlArg('bid');\r
-    return $batchId;\r
-  }\r
-\r
-  function _testAssignBatch($numberOfTrxn) {\r
-    $this->select( "xpath=//div[@id='crm-transaction-selector-assign_length']/label/select[@name='crm-transaction-selector-assign_length']", "value=$numberOfTrxn" );\r
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.3                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License along with this program; if not, contact CiviCRM LLC       |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | 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';
+class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase {
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  function testAddFinancialBatch() {
+    // Log in using webtestLogin() method
+    $this->webtestLogin('admin');
+    $this->openCiviPage("financial/batch", "reset=1&action=add", '_qf_FinancialBatch_next-botttom');
+    $setTitle = 'Batch ' . substr(sha1(rand()), 0, 7) . date('Y-m-d');
+    $setDescription  = 'Test Batch Creation';
+    $setPaymentInstrument = 'Credit Card';
+    $numberOfTrxn = '10'; // can be 10, 25, 50, 100
+    $totalAmt = '1000';
+    $exportFormat = 'CSV';
+    $batchId = $this->_testAddBatch(
+      $setTitle,
+      $setDescription,
+      $setPaymentInstrument,
+      $numberOfTrxn,
+      $totalAmt
+    );
+    $this->_testAssignBatch($numberOfTrxn);
+    $this->_testExportBatch($setTitle, $batchId, $exportFormat);
+  }
+
+  function _testAddBatch($setTitle, $setDescription, $setPaymentInstrument, $numberOfTrxn, $totalAmt) {
+    // Enter Optional Constraints
+    $this->type('title', $setTitle);
+    $this->type('description', $setDescription);
+    if ($setPaymentInstrument == 'Credit Card') {
+      $this->select("payment_instrument_id", "value=1");
+    }
+    elseif ($setPaymentInstrument == 'Debit Card') {
+      $this->select("payment_instrument_id", "value=2");
+    }
+    elseif ($setPaymentInstrument == 'Cash') {
+      $this->select("payment_instrument_id", "value=3");
+    }
+    elseif ($setPaymentInstrument == 'Check') {
+      $this->select("payment_instrument_id", "value=4");
+    }
+    elseif ($setPaymentInstrument == 'EFT') {
+      $this->select("payment_instrument_id", "value=5");
+    }
+    $this->type('item_count', $numberOfTrxn);
+    $this->type('total', $totalAmt);
+
+    $this->click('_qf_FinancialBatch_next-botttom');
+    $this->waitForPageToLoad($this->getTimeoutMsec());
+
+    // parse URL to grab the batch ID
+    $batchId = $this->urlArg('bid');
+    return $batchId;
+  }
+
+  function _testAssignBatch($numberOfTrxn) {
+    $this->select( "xpath=//div[@id='crm-transaction-selector-assign_length']/label/select[@name='crm-transaction-selector-assign_length']", "value=$numberOfTrxn" );
     // 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
-    sleep(5);\r
-    $this->click('toggleSelect');\r
-    $this->select('trans_assign', 'value=Assign');\r
-    $this->click('Go');\r
-    $this->waitForPageToLoad($this->getTimeoutMsec());\r
-  }\r
-\r
-  function _testExportBatch($setTitle, $batchId, $exportFormat) {\r
-    $this->openCiviPage("financial/batch", "reset=1&action=export&id=$batchId");\r
-    if ($exportFormat == 'CSV') {\r
-      $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[2]");\r
-      $this->click('_qf_FinancialBatch_next-botttom');\r
-      $this->waitForPageToLoad($this->getTimeoutMsec());\r
-    }\r
-    else {\r
-      $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[1]");\r
-      $this->click('_qf_FinancialBatch_next-botttom');\r
-      $this->waitForPageToLoad($this->getTimeoutMsec());\r
-    }\r
-    $this->openCiviPage("dashboard", "reset=1");\r
-    $this->waitForPageToLoad($this->getTimeoutMsec());\r
-\r
-    $this->clickLink("xpath=//div[@id='recently-viewed']/ul/li[1]/a", "_qf_Activity_cancel-bottom");\r
-    $this->webtestVerifyTabularData(\r
-      array(\r
-        'Current Attachment(s)' => 'Financial_Transactions_'\r
-      )\r
-    );\r
-  }\r
-}\r
+    sleep(5);
+    $this->click('toggleSelect');
+    $this->select('trans_assign', 'value=Assign');
+    $this->click('Go');
+    $this->waitForPageToLoad($this->getTimeoutMsec());
+  }
+
+  function _testExportBatch($setTitle, $batchId, $exportFormat) {
+    $this->openCiviPage("financial/batch", "reset=1&action=export&id=$batchId");
+    if ($exportFormat == 'CSV') {
+      $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[2]");
+      $this->click('_qf_FinancialBatch_next-botttom');
+      $this->waitForPageToLoad($this->getTimeoutMsec());
+    }
+    else {
+      $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[1]");
+      $this->click('_qf_FinancialBatch_next-botttom');
+      $this->waitForPageToLoad($this->getTimeoutMsec());
+    }
+    $this->openCiviPage("dashboard", "reset=1");
+    $this->waitForPageToLoad($this->getTimeoutMsec());
+
+    $this->clickLink("xpath=//div[@id='recently-viewed']/ul/li[1]/a", "_qf_Activity_cancel-bottom");
+    $this->webtestVerifyTabularData(
+      array(
+        'Current Attachment(s)' => 'Financial_Transactions_'
+      )
+    );
+  }
+}