version fixes
[civicrm-core.git] / tests / phpunit / WebTest / Member / EditMembershipTest.php
CommitLineData
6a488035 1<?php
9d15e987 2/*
6a488035 3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
6a488035 5 +--------------------------------------------------------------------+
e7112fa7 6 | Copyright CiviCRM LLC (c) 2004-2015 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
d25dd0ee 25 */
6a488035 26
6a488035 27require_once 'CiviTest/CiviSeleniumTestCase.php';
e9479dcf
EM
28
29/**
30 * Class WebTest_Member_EditMembershipTest
31 */
6a488035
TO
32class WebTest_Member_EditMembershipTest extends CiviSeleniumTestCase {
33 protected function setUp() {
34 parent::setUp();
35 }
36
00be9182 37 public function testEditMembershipActivityTypes() {
6a488035
TO
38 // Log in using webtestLogin() method
39 $this->webtestLogin();
40 // create contact
41 $firstName = substr(sha1(rand()), 0, 7);
42 $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name");
43 $contactName = "Memberson, {$firstName}";
44 $displayName = "{$firstName} Memberson";
45
46 // add membership type
47 $membershipTypes = $this->webtestAddMembershipType();
48
49 // now add membership
9d15e987 50 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
6a488035
TO
51
52 // select contact
53 $this->webtestFillAutocomplete($contactName);
54
55 // fill in Membership Organization
56 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
57
58 // select membership type
59 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
60
61 // fill in Source
62 $this->type("source", "Membership StandaloneAddTest Webtest");
63
64 // Let Join Date and Start Date stay default
65 $this->click("_qf_Membership_upload");
66
67 //View Membership
68 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
69 $this->click("xpath=//div[@id='memberships']//table/tbody/tr[1]/td[9]/span/a[text()='View']");
70 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
71 $expected = array(
92915c55 72 'Membership Type' => $membershipTypes['membership_type'],
9d15e987
PJ
73 'Status' => 'New',
74 'Source' => 'Membership StandaloneAddTest Webtest',
6a488035 75 );
9d15e987 76 $this->webtestVerifyTabularData($expected);
6a488035
TO
77
78 // now edit and update type and status
79 $this->click("crm-membership-edit-button-top");
80 $this->waitForElementPresent("_qf_Membership_upload-bottom");
81 $this->click('is_override');
82 $this->waitForElementPresent('status_id');
83 $this->select('status_id', 'label=Current');
e87cf20c 84 $this->select('membership_type_id[0]', 'value=1');
85 $this->select('membership_type_id[1]', 'value=1');
6a488035
TO
86 $this->click('_qf_Membership_upload-bottom');
87
88 $this->waitForElementPresent("access");
89
90 // Use activity search to find the expected activities
9d15e987
PJ
91 $this->openCiviPage('activity/search', 'reset=1', "_qf_Search_refresh");
92
6a488035 93 $this->type("sort_name", $contactName);
e0f528d0 94 $this->select('activity_type_id', 'value=35');
95 $this->select('activity_type_id', 'value=36');
c3ad8633 96 $this->clickLink("_qf_Search_refresh");
6a488035 97
e0f528d0 98 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[2]/td[2][text()='Change Membership Type']"));
99 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[2]/td[3][text()='Type changed from {$membershipTypes['membership_type']} to General']"));
6a488035 100 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[2]/td[5]/a[text()='{$contactName}']"));
6a488035 101 }
96025800 102
42daf119 103}