3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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['PayPal_Standard'] = "PayPal Standard ($hash)";
65 $processors = array();
66 foreach ($this->names
as $key => $val) {
67 $processors[$val] = $key;
70 // create new contribution page
71 $this->pageId
= $this->webtestAddContributionPage(
74 $pageTitle = $contributionPageTitle,
75 $processor = $processors,
76 $amountSection = TRUE,
81 $membershipTypes = FALSE,
82 $memPriceSetId = NULL,
85 $profilePostId = NULL,
89 $isAddPaymentProcessor = TRUE,
90 $isPcpApprovalNeeded = FALSE,
91 $isSeparatePayment = FALSE,
92 $honoreeSection = FALSE,
93 $allowOtherAmount = TRUE
97 $this->openCiviPage("admin/setting/url", "reset=1");
98 $this->click("id=CIVICRM_QFID_1_verifySSL");
99 $this->click("id=_qf_Url_next-bottom");
100 $this->waitForPageToLoad($this->getTimeoutMsec());
102 $this->initialized
= TRUE;
107 * @param string $name
109 public function _tryPaymentProcessor($name) {
110 // load contribution page
111 $this->openCiviPage("contribute/transact", "reset=1&action=preview&id={$this->pageId}", "_qf_Main_upload-bottom");
114 $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", "30");
115 $this->type('email-5', "smith@example.com");
117 // choose the payment processor
118 $this->click("xpath=//label[text() = '{$name}']/preceding-sibling::input[1]");
120 // do we need to add credit card details?
121 if (strpos($name, "AuthNet") !== FALSE ||
strpos($name, "PayPal Pro") !== FALSE) {
122 $this->webtestAddCreditCardDetails();
123 list($firstName, $middleName, $lastName) = $this->webtestAddBillingDetails();
126 // submit contribution
127 $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
129 // confirm contribution
130 $this->click("_qf_Confirm_next-bottom");
131 $this->waitForPageToLoad($this->getTimeoutMsec());
132 $this->assertStringsPresent("Payment Processor Error message");