From c432c016ddc41b1258b6d2804b58d5a0576d8eb3 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Fri, 6 Nov 2015 21:19:38 +0530 Subject: [PATCH] 4.7beta1 webtest and corebug fixes --- CRM/Contribute/Form/Contribution/Main.php | 7 +++---- CRM/Mailing/BAO/Query.php | 2 +- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 3 +-- .../WebTest/Contribute/OfflineContributionTest.php | 8 +++++++- tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php | 6 +++--- .../WebTest/Member/DefaultMembershipPricesetTest.php | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index d03eb0557a..d3085edc7e 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -204,14 +204,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->_defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince; } - $entityId = NULL; + $entityId = $memtypeID = NULL; if ($this->_priceSetId) { if (($this->_useForMember && !empty($this->_currentMemberships)) || $this->_defaultMemTypeId) { $selectedCurrentMemTypes = array(); foreach ($this->_priceSet['fields'] as $key => $val) { foreach ($val['options'] as $keys => $values) { $opMemTypeId = CRM_Utils_Array::value('membership_type_id', $values); - $priceFieldName = 'price_' . $values['price_field_id']; $priceFieldValue = CRM_Price_BAO_PriceSet::getPriceFieldValueFromURL($this, $priceFieldName); if (!empty($priceFieldValue)) { CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $priceFieldValue, $val['html_type'], $this->_defaults); @@ -226,7 +225,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu !in_array($opMemTypeId, $selectedCurrentMemTypes) ) { CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults); - $selectedCurrentMemTypes[] = $values['membership_type_id']; + $memtypeID = $selectedCurrentMemTypes[] = $values['membership_type_id']; } elseif (!empty($values['is_default']) && !$opMemTypeId && @@ -235,10 +234,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu !isset($this->_defaults[$priceFieldName][$keys])) )) { CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults); + $memtypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_defaults[$priceFieldName], 'membership_type_id'); } } } - $memtypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_defaults[$priceFieldName], 'membership_type_id'); $entityId = CRM_Utils_Array::value('id', CRM_Member_BAO_Membership::getContactMembership($contactID, $memtypeID, NULL)); } else { diff --git a/CRM/Mailing/BAO/Query.php b/CRM/Mailing/BAO/Query.php index 372868819e..2cf2f04cd8 100644 --- a/CRM/Mailing/BAO/Query.php +++ b/CRM/Mailing/BAO/Query.php @@ -381,7 +381,7 @@ class CRM_Mailing_BAO_Query { case 'mailing_campaign_id': $name = 'campaign_id'; - CRM_Contact_BAO_Query::buildClause("civicrm_mailing.$name", $op, $value, 'Integer'); + $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_mailing.$name", $op, $value, 'Integer'); list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Mailing_DAO_Mailing', $name, $value, $op); $query->_qill[$grouping][] = ts('Campaign %1 %2', array(1 => $op, 2 => $value)); $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1; diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 2d8cea4dfd..9042202327 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1375,9 +1375,8 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $text = "'Premium' information has been saved."; $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); - $this->openCiviPage("admin/contribute", "reset=1"); + $this->openCiviPage("admin/contribute/premium", "reset=1&action=update&id={$pageId}"); $this->waitForAjaxContent(); - $this->click("xpath=//table['dataTables_wrapper no-footer']/tbody//tr/td[1]/strong[text()='$pageTitle']/../../td[4]/div[1]/span/ul/li[8]/a[text()='Premiums']"); $this->waitForElementPresent('_qf_Premium_cancel-bottom'); $this->click("xpath=//div[@class='messages status no-popup']/a[text()='add one']"); $this->waitForElementPresent('_qf_AddProduct_cancel-bottom'); diff --git a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php index 9c2b759cd3..493f4e12cd 100644 --- a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php @@ -205,6 +205,12 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { public function testDeductibleAmount() { $this->webtestLogin(); + // disable verify ssl when using authorize .net + $this->openCiviPage("admin/setting/url", "reset=1"); + $this->click("id=CIVICRM_QFID_0_verifySSL"); + $this->click("id=_qf_Url_next-bottom"); + $this->waitForPageToLoad($this->getTimeoutMsec()); + //add authorize .net payment processor $processorName = 'Webtest AuthNet' . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName, 'AuthNet'); @@ -359,7 +365,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // Is status message correct? - $this->assertTrue($this->isTextPresent("The contribution record has been processed."), "Status message didn't show up after saving!"); + $this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!"); } /** diff --git a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php index 977f31c946..e0ce2e1177 100644 --- a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php +++ b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php @@ -53,8 +53,8 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->select('tag', 'label=Major Donor'); $this->click('_qf_Basic_refresh'); $this->waitForElementPresent('search-status'); - $this->assertText('search-status', "Contact Type IN 'Individual'"); - $this->assertText('search-status', 'Tagged IN Major Donor'); + $this->assertText('search-status', "Contact Type In Individual"); + $this->assertText('search-status', 'Tagged = Major Donor'); // Advanced Search by Tag $this->click("css=ul#civicrm-menu li.crm-Search"); @@ -63,7 +63,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->select('contact_tags', 'label=Major Donor'); $this->click('_qf_Advanced_refresh'); $this->waitForElementPresent('search-status'); - $this->assertText('search-status', 'Tagged IN Major Donor'); + $this->assertText('search-status', 'Tagged In Major Donor'); } public function testNewIndividual() { diff --git a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php index e17b9104e4..a857753ca7 100755 --- a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php +++ b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php @@ -120,7 +120,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase $this->_testDefaultSenarios("national_membership_{$title}-section", 1); $this->contactInfoFill($firstName, $lastName, $email, $contactParams, $streetAddress); - $this->clickLink("_qf_Main_upload-bottom", "_qf_Main_upload-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->assertTrue($this->isTextPresent("You already have a lifetime membership and cannot select a membership with a shorter term.")); } -- 2.25.1