X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FMember%2FStandaloneAddTest.php;h=d719d4287dcfd4f2c74ff7e04f4b9cbf61803fe3;hb=6c6e618724401e4472f7763cce97375dd47a7fdc;hp=5cf1684c054bfb15ace5d2ed08091e17998bc48d;hpb=6643a63b47c9607cdc5f14a739cf7c7cfe55d726;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Member/StandaloneAddTest.php b/tests/phpunit/WebTest/Member/StandaloneAddTest.php index 5cf1684c05..d719d4287d 100644 --- a/tests/phpunit/WebTest/Member/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Member/StandaloneAddTest.php @@ -1,7 +1,7 @@ webtestLogin(); @@ -67,7 +71,8 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { // fill in Status Override? // fill in Record Membership Payment? - + $this->click("send_receipt"); + $this->assertTrue($this->isChecked("send_receipt"), 'Send Confirmation and Receipt checkbox should be checked.'); $this->click("_qf_Membership_upload"); //View Membership @@ -83,7 +88,75 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { $this->webtestVerifyTabularData($expected); } - function testStandaloneMemberOverrideAdd() { + public function testStandaloneGiftMembership() { + + $this->webtestLogin(); + + // create contact + $firstName = substr(sha1(rand()), 0, 7); + $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name"); + $contactName = "Memberson, $firstName"; + + $giftMemberfirstName = substr(sha1(rand()), 0, 7); + $this->webtestAddContact($giftMemberfirstName, "Memberson", "Memberson{$giftMemberfirstName}@memberson.name"); + $giftMembercontactName = "Memberson, $giftMemberfirstName"; + + // add membership type + $membershipTypes = $this->webtestAddMembershipType(); + + // now add membership + $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload"); + + // select contact + $this->webtestFillAutocomplete($firstName); + + // fill in Membership Organization + $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}"); + + // select membership type + $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}"); + + // fill in Source + $this->type("source", "Membership StandaloneAddTest Webtest"); + + // fill in Start Date + $this->webtestFillDate('start_date'); + + // add softcredit details + $totalAmount = 100; + $financialType = 'Donation'; + $this->clickLink('is_different_contribution_contact', 'total_amount', FALSE); + + $this->select('soft_credit_type_id', 'Gift'); + $this->select2('soft_credit_contact_id', $giftMembercontactName); + $this->select('financial_type_id', 'Donation'); + $this->type('total_amount', $totalAmount); + $this->select('payment_instrument_id', 'Check'); + $this->select('contribution_status_id', 'Completed'); + + $this->click("_qf_Membership_upload"); + + //View Membership + $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']"); + $this->click("xpath=//div[@id='memberships']//table/tbody/tr[1]/td[9]/span/a[text()='View']"); + $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); + + // verify soft credit data + $expected = array( + '1' => $giftMemberfirstName.' Memberson', + '2' => $totalAmount, + '3' => 'Gift', + '4' => 'Donation', + '6' => 'Completed', + ); + + foreach($expected as $key => $value) { + $this->verifyText("xpath=//div[@class='crm-accordion-wrapper']//table/tbody//tr/td[$key]", $value); + } + + } + + public function testStandaloneMemberOverrideAdd() { $this->webtestLogin(); @@ -125,7 +198,7 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { // fill in Record Membership Payment? $this->click("record_contribution", "value=1"); $this->waitForElementPresent("contribution_status_id"); - // let financial type be default + // let financial type be default // let the amount be default @@ -162,7 +235,7 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { $this->webtestVerifyTabularData($expected); } - function testAjaxCustomGroupLoad() { + public function testAjaxCustomGroupLoad() { $this->webtestLogin(); $triggerElement = array('name' => 'membership_type_id_1', 'type' => 'select'); $customSets = array( @@ -177,7 +250,7 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { $test = $this; $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, function() use ($test) { - $test->select('membership_type_id_0', 'value=1'); + $test->select('membership_type_id_0', 'value=1'); } ); }