From: Jitendra Purohit Date: Thu, 21 Aug 2014 07:23:50 +0000 (+0530) Subject: CRM-15137 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=130ad8705c6c98876562f07a95ebd789c36a1ab5;p=civicrm-core.git CRM-15137 --- diff --git a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php index a4af1e2673..70ae4d40d3 100644 --- a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php +++ b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php @@ -558,6 +558,92 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->_testOrganization($pageId, $cid, $pageTitle); } + function testWithContactSubtypeDupe() { + $this->webtestLogin(); + + //create organisation + $orgName = "Org WebAccess ". substr(sha1(rand()), 0, 7); + $orgEmail = "org". substr(sha1(rand()), 0, 7) . "@web.com"; + $contactSubType = 'Sponsor'; + $this->webtestAddOrganization($orgName, $orgEmail, $contactSubType); + + $this->waitForPageToLoad($this->getTimeoutMsec()); + $cid = $this->urlArg('cid'); + + $pageTitle = substr(sha1(rand()), 0, 7); + $rand = 100; + $hash = substr(sha1(rand()), 0, 7); + $amountSection = TRUE; + $payLater = TRUE; + $onBehalf = TRUE; + $pledges = FALSE; + $recurring = FALSE; + $memberships = FALSE; + $memPriceSetId = NULL; + $friend = FALSE; + $profilePreId = NULL; + $profilePostId = NULL; + $premiums = FALSE; + $widget = FALSE; + $pcp = FALSE; + $honoreeSection = FALSE; + $isAddPaymentProcessor = FALSE; + $isPcpApprovalNeeded = FALSE; + $isSeparatePayment = FALSE; + + // create a new online contribution page + // create contribution page with randomized title and default params + $pageId = $this->webtestAddContributionPage($hash, + $rand, + $pageTitle, + null, + $amountSection, + $payLater, + $onBehalf, + $pledges, + $recurring, + $memberships, + $memPriceSetId, + $friend, + $profilePreId, + $profilePostId, + $premiums, + $widget, + $pcp, + $isAddPaymentProcessor, + $isPcpApprovalNeeded, + $isSeparatePayment, + $honoreeSection + ); + + //Open Live Contribution Page + $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom"); + $this->waitForElementPresent("onbehalf_state_province-3"); + + $this->type("onbehalf_organization_name", $orgName); + $this->waitForElementPresent("onbehalf_phone-3-1"); + $this->type("onbehalf_phone-3-1", 9999999999); + $this->waitForElementPresent("onbehalf_email-3"); + $this->type("onbehalf_email-3", "org@example.com"); + $this->type("onbehalf_street_address-3", "Test Street Address"); + $this->type("onbehalf_city-3", "Test City"); + $this->type("onbehalf_postal_code-3", substr(sha1(rand()), 0, 6)); + $this->click("onbehalf_country-3"); + $this->select("onbehalf_country-3", "label=United States"); + $this->click("onbehalf_state_province-3"); + $this->select("onbehalf_state_province-3", "label=Alabama"); + + $this->waitForElementPresent("_qf_Main_upload-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); + + $this->click("_qf_Confirm_next-bottom"); + $this->waitForPageToLoad($this->getTimeoutMsec()); + + $this->openCiviPage("contact/view", "reset=1&cid=$cid", "xpath=//div[@class='crm-content crm-contact_type_label']"); + + $this->verifyText("xpath=//div[@class='crm-content crm-contact_type_label']", $contactSubType); + } + /** * @param $pageId * @param $cid