3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Contribute_VerifySSLContributionTest
32 class WebTest_Contribute_VerifySSLContributionTest
extends CiviSeleniumTestCase
{
34 protected $initialized = FALSE;
35 protected $names = array();
36 protected $pageId = 0;
38 protected function setUp() {
42 public function testPaymentProcessorsSSL() {
43 $this->markTestSkipped('Skipping for now as it works fine locally.');
45 $this->_tryPaymentProcessor($this->names
['AuthNet']);
47 // todo: write code to check other payment processors
48 /*$this->_tryPaymentProcessor($this->names['Google_Checkout']);
49 $this->_tryPaymentProcessor($this->names['PayPal']);
50 $this->_tryPaymentProcessor($this->names['PayPal_Standard']);*/
53 public function _initialize() {
54 if (!$this->initialized
) {
56 $this->webtestLogin();
59 $hash = substr(sha1(rand()), 0, 7);
60 $contributionPageTitle = "Verify SSL ($hash)";
61 $this->names
['PayPal'] = "PayPal Pro ($hash)";
62 $this->names
['AuthNet'] = "AuthNet ($hash)";
63 //$this->names['Google_Checkout'] = "Google Checkout ($hash)";
64 //$this->names['PayPal_Standard'] = "PayPal Standard ($hash)";
66 $processors = array();
67 foreach ($this->names
as $key => $val) {
68 $processors[$val] = $key;
71 // create new contribution page
72 $this->pageId
= $this->webtestAddContributionPage(
75 $pageTitle = $contributionPageTitle,
76 $processor = $processors,
77 $amountSection = TRUE,
82 $membershipTypes = FALSE,
83 $memPriceSetId = NULL,
86 $profilePostId = NULL,
90 $isAddPaymentProcessor = TRUE,
91 $isPcpApprovalNeeded = FALSE,
92 $isSeparatePayment = FALSE,
93 $honoreeSection = FALSE,
94 $allowOtherAmount = TRUE
98 $this->openCiviPage("admin/setting/url", "reset=1");
99 $this->click("id=CIVICRM_QFID_1_verifySSL");
100 $this->click("id=_qf_Url_next-bottom");
101 $this->waitForPageToLoad($this->getTimeoutMsec());
103 $this->initialized
= TRUE;
108 * @param string $name
110 public function _tryPaymentProcessor($name) {
111 // load contribution page
112 $this->openCiviPage("contribute/transact", "reset=1&action=preview&id={$this->pageId}", "_qf_Main_upload-bottom");
115 $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", "30");
116 $this->type('email-5', "smith@example.com");
118 // choose the payment processor
119 $this->click("xpath=//label[text() = '{$name}']/preceding-sibling::input[1]");
121 // do we need to add credit card details?
122 if (strpos($name, "AuthNet") !== FALSE ||
strpos($name, "PayPal Pro") !== FALSE) {
123 $this->webtestAddCreditCardDetails();
124 list($firstName, $middleName, $lastName) = $this->webtestAddBillingDetails();
127 // submit contribution
128 $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
130 // confirm contribution
131 $this->click("_qf_Confirm_next-bottom");
132 $this->waitForPageToLoad($this->getTimeoutMsec());
133 $this->assertStringsPresent("Payment Processor Error message");