Fixed some contribution pages
[civicrm-core.git] / tests / phpunit / WebTest / Member / FixedMembershipTypeTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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 +--------------------------------------------------------------------+
25 */
26
27
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Member_FixedMembershipTypeTest extends CiviSeleniumTestCase {
30
31 protected function setUp() {
32 parent::setUp();
33 }
34
35 function testMembershipTypeScenario1() {
36 // Scenario 1
37 // Rollover Date < Start Date
38 // Join Date > Rollover Date and Join Date < Start Date
39
40
41 // Log in using webtestLogin() method
42 $this->webtestLogin();
43
44 $this->openCiviPage("contact/add", "reset=1&ct=Organization", '_qf_Contact_cancel');
45
46 $title = substr(sha1(rand()), 0, 7);
47 $this->type('organization_name', "Organization $title");
48 $this->type('email_1_email', "$title@org.com");
49 $this->click('_qf_Contact_upload_view');
50 $this->waitForPageToLoad($this->getTimeoutMsec());
51
52 $this->assertTrue($this->isTextPresent("Organization $title has been created."));
53
54 $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse");
55
56 $this->click("link=Add Membership Type");
57 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
58
59 $this->type('name', "Membership Type $title");
60 $this->type('member_of_contact', $title);
61 $this->click('member_of_contact');
62 $this->waitForElementPresent("css=div.ac_results-inner li");
63 $this->click("css=div.ac_results-inner li");
64
65 $this->type('minimum_fee', '100');
66 $this->select( 'financial_type_id', 'value=2' );
67 $this->type('duration_interval', 1);
68 $this->select('duration_unit', "label=year");
69
70 $this->select('period_type', "label=fixed");
71 $this->waitForElementPresent('fixed_period_rollover_day[d]');
72
73 // fixed period start set to April 1
74 $this->select('fixed_period_start_day[M]', 'value=4');
75 // rollover date set to Jan 31
76 $this->select('fixed_period_rollover_day[M]', 'value=1');
77
78 $this->click('relationship_type_id', 'value=4_b_a');
79
80 $this->click('_qf_MembershipType_upload-bottom');
81 $this->waitForElementPresent('link=Add Membership Type');
82 $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved."));
83
84 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
85
86 $firstName = "John_" . substr(sha1(rand()), 0, 7);
87
88 //fill in first name
89 $this->type('first_name', $firstName);
90
91 //fill in last name
92 $lastName = "Smith_" . substr(sha1(rand()), 0, 7);;
93 $this->type('last_name', $lastName);
94
95 //fill in email
96 $email = substr(sha1(rand()), 0, 7) . "john@gmail.com";
97 $this->type('email_1_email', $email);
98
99 // Clicking save.
100 $this->click('_qf_Contact_upload_view');
101 $this->waitForPageToLoad($this->getTimeoutMsec());
102 $this->assertTrue($this->isTextPresent("$firstName $lastName has been created."));
103
104 // click through to the membership view screen
105 $this->click('css=li#tab_member a');
106
107 $this->waitForElementPresent('link=Add Membership');
108 $this->click('link=Add Membership');
109
110 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
111
112 // fill in Membership Organization and Type
113 $this->select('membership_type_id[0]', "label=Organization $title");
114 $this->select('membership_type_id[1]', "label=Membership Type $title");
115
116 $sourceText = "Membership ContactAddTest with Fixed Membership Type";
117 // fill in Source
118 $this->type('source', $sourceText);
119
120 //build the membership dates.
121 require_once 'CRM/Core/Config.php';
122 require_once 'CRM/Utils/Array.php';
123 require_once 'CRM/Utils/Date.php';
124 $currentYear = date('Y');
125 $currentMonth = date('m');
126 $previousYear = $currentYear - 1;
127 $nextYear = $currentYear + 1;
128
129 $todayDate = date('Y-m-d');
130
131 // the member-since date we will type in to membership form
132 $joinDate = date('Y-m-d', mktime(0, 0, 0, 3, 25, $currentYear));
133
134 // expected calc'd start date
135 $startDate = date('Y-m-d', mktime(0, 0, 0, 4, 1, $previousYear));
136
137 // expected calc'd end date
138 $endDate = date('Y-m-d', mktime(0, 0, 0, 3, 31, $nextYear));
139
140 $configVars = new CRM_Core_Config_Variables();
141 foreach (array(
142 'joinDate', 'startDate', 'endDate') as $date) {
143 $$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
144 }
145
146 $query = "
147 SELECT end_event_adjust_interval
148 FROM civicrm_membership_status
149 WHERE start_event = 'join_date'
150 AND name = 'New'";
151 $endInterval = CRM_Core_DAO::singleValueQuery($query);
152
153 // Add endInterval to March 25 (join date month above) to get end of New status period
154 $endNewStatus = date('Y-m-d', mktime(0, 0, 0, $endInterval + 3, 25, $currentYear));
155
156 $status = 'Current';
157 // status will be 'New' if today is >= join date and <= endNewStatus date
158 if ((strtotime($todayDate) >= strtotime($joinDate)) && (strtotime($todayDate) <= strtotime($endNewStatus))) {
159 $status = 'New';
160 }
161
162 // fill in Join Date
163 $this->webtestFillDate('join_date', $joinDate);
164
165 // Clicking save.
166 $this->click('_qf_Membership_upload');
167 $this->waitForPageToLoad($this->getTimeoutMsec());
168
169 // page was loaded
170 $this->waitForTextPresent($sourceText);
171
172 // Is status message correct?
173 $this->assertTrue($this->isTextPresent("Membership Type $title membership for $firstName $lastName has been added."),
174 "Status message didn't show up after saving!"
175 );
176
177 // click through to the membership view screen
178 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
179 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
180
181 $this->webtestVerifyTabularData(
182 array(
183 'Membership Type' => "Membership Type $title",
184 'Status' => $status,
185 'Source' => $sourceText,
186 'Member Since' => $joinDate,
187 'Start date' => $startDate,
188 'End date' => $endDate,
189 )
190 );
191 }
192
193 function testMembershipTypeScenario2() {
194 // Scenario 2
195 // Rollover Date < Join Date
196
197
198 // Log in using webtestLogin() method
199 $this->webtestLogin();
200
201 $this->openCiviPage("contact/add", "reset=1&ct=Organization", '_qf_Contact_cancel');
202
203 $title = substr(sha1(rand()), 0, 7);
204 $this->type('organization_name', "Organization $title");
205 $this->type('email_1_email', "$title@org.com");
206 $this->click('_qf_Contact_upload_view');
207 $this->waitForPageToLoad($this->getTimeoutMsec());
208
209 $this->assertTrue($this->isTextPresent("Organization $title has been created."));
210
211 $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse");
212
213 $this->click("link=Add Membership Type");
214 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
215
216 $this->type('name', "Membership Type $title");
217 $this->type('member_of_contact', $title);
218 $this->click('member_of_contact');
219 $this->waitForElementPresent("css=div.ac_results-inner li");
220 $this->click("css=div.ac_results-inner li");
221
222 $this->type('minimum_fee', '100');
223 $this->select( 'financial_type_id', 'value=2' );
224
225 $this->type('duration_interval', 2);
226 $this->select('duration_unit', "label=year");
227
228 $this->select('period_type', "label=fixed");
229 $this->waitForElementPresent('fixed_period_rollover_day[d]');
230
231 $this->select('fixed_period_start_day[M]', 'value=9');
232 $this->select('fixed_period_rollover_day[M]', 'value=6');
233 $this->select('fixed_period_rollover_day[d]', 'value=30');
234
235 $this->click('relationship_type_id', 'value=4_b_a');
236
237 $this->click('_qf_MembershipType_upload-bottom');
238 $this->waitForElementPresent('link=Add Membership Type');
239 $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved."));
240
241 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
242
243 $firstName = "John_" . substr(sha1(rand()), 0, 7);
244
245 //fill in first name
246 $this->type('first_name', $firstName);
247
248 //fill in last name
249 $lastName = "Smith_" . substr(sha1(rand()), 0, 7);;
250 $this->type('last_name', $lastName);
251
252 //fill in email
253 $email = substr(sha1(rand()), 0, 7) . "john@gmail.com";
254 $this->type('email_1_email', $email);
255
256 // Clicking save.
257 $this->click('_qf_Contact_upload_view');
258 $this->waitForPageToLoad($this->getTimeoutMsec());
259
260 $this->assertTrue($this->isTextPresent("$firstName $lastName has been created."));
261
262 // click through to the membership add screen
263 $this->click('css=li#tab_member a');
264
265 $this->waitForElementPresent('link=Add Membership');
266 $this->click('link=Add Membership');
267
268 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
269
270 // fill in Membership Organization and Type
271 $this->select('membership_type_id[0]', "label=Organization {$title}");
272 // Wait for membership type select to reload
273 $this->waitForTextPresent("Membership Type {$title}");
274 $this->select('membership_type_id[1]', "label=Membership Type {$title}");
275
276 $sourceText = "Membership ContactAddTest with Fixed Membership Type Scenario 2";
277 // fill in Source
278 $this->type('source', $sourceText);
279
280 //build the membership dates.
281 require_once 'CRM/Core/Config.php';
282 require_once 'CRM/Utils/Array.php';
283 require_once 'CRM/Utils/Date.php';
284 $currentYear = date('Y');
285 $currentMonth = date('m');
286 $previousYear = $currentYear - 1;
287
288 $todayDate = date('Y-m-d');
289
290 // the member-since date we will type in to membership form
291 $joinDate = date('Y-m-d', mktime(0, 0, 0, 7, 15, $currentYear));
292
293 // expected calc'd start date
294 $startDate = date('Y-m-d', mktime(0, 0, 0, 9, 1, $previousYear));
295
296 // expected calc'd end date
297 $endDate = date('Y-m-d', mktime(0, 0, 0, 8, 31, $currentYear + 2));
298 $configVars = new CRM_Core_Config_Variables();
299 foreach (array(
300 'joinDate', 'startDate', 'endDate') as $date) {
301 $$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
302 }
303
304 $query = "
305 SELECT end_event_adjust_interval
306 FROM civicrm_membership_status
307 WHERE start_event = 'join_date'
308 AND name = 'New'";
309 $endInterval = CRM_Core_DAO::singleValueQuery($query);
310
311 // Add endInterval to July 15 (join date month above) to get end of New status period
312 $endNewStatus = date('Y-m-d', mktime(0, 0, 0, $endInterval + 7, 15, $currentYear));
313
314 $status = 'Current';
315 // status will be 'New' if today is >= join date and <= endNewStatus date
316 if ((strtotime($todayDate) >= strtotime($joinDate)) && (strtotime($todayDate) <= strtotime($endNewStatus))) {
317 $status = 'New';
318 }
319
320 // fill in Join Date
321 $this->webtestFillDate('join_date', $joinDate);
322
323 // Clicking save.
324 $this->click('_qf_Membership_upload');
325 $this->waitForPageToLoad($this->getTimeoutMsec());
326
327 // page was loaded
328 $this->waitForTextPresent($sourceText);
329
330 // Is status message correct?
331 $this->assertTrue($this->isTextPresent("Membership Type $title membership for $firstName $lastName has been added."),
332 "Status message didn't show up after saving!"
333 );
334
335 // click through to the membership view screen
336 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
337 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
338
339 $this->webtestVerifyTabularData(
340 array(
341 'Membership Type' => "Membership Type {$title}",
342 'Status' => $status,
343 'Source' => $sourceText,
344 'Member Since' => $joinDate,
345 'Start date' => $startDate,
346 'End date' => $endDate,
347 )
348 );
349 }
350
351 function testMembershipTypeScenario3() {
352 // Scenario 3
353 // Standard Fixed scenario - Jan 1 Fixed Period Start and October 31 rollover
354 // Join Date is later than Rollover Date
355
356
357 // Log in using webtestLogin() method
358 $this->webtestLogin();
359
360 $this->openCiviPage("contact/add", "reset=1&ct=Organization", '_qf_Contact_cancel');
361
362 $title = substr(sha1(rand()), 0, 7);
363 $this->type('organization_name', "Organization $title");
364 $this->type('email_1_email', "$title@org.com");
365 $this->click('_qf_Contact_upload_view');
366 $this->waitForPageToLoad($this->getTimeoutMsec());
367
368 $this->assertTrue($this->isTextPresent("Organization $title has been created."));
369
370 $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse");
371
372 $this->click("link=Add Membership Type");
373 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
374
375 $this->type('name', "Membership Type $title");
376 $this->type('member_of_contact', $title);
377 $this->click('member_of_contact');
378 $this->waitForElementPresent("css=div.ac_results-inner li");
379 $this->click("css=div.ac_results-inner li");
380
381 $this->type('minimum_fee', '100');
382 $this->select( 'financial_type_id', 'value=2' );
383 $this->type('duration_interval', 1);
384 $this->select('duration_unit', "label=year");
385
386 $this->select('period_type', "label=fixed");
387 $this->waitForElementPresent('fixed_period_rollover_day[d]');
388
389 $this->select('fixed_period_rollover_day[M]', 'value=10');
390 $this->select('fixed_period_rollover_day[d]', 'value=31');
391
392 $this->click('relationship_type_id', 'value=4_b_a');
393
394 $this->click('_qf_MembershipType_upload-bottom');
395 $this->waitForElementPresent('link=Add Membership Type');
396 $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved."));
397
398 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
399
400 $firstName = "John_" . substr(sha1(rand()), 0, 7);
401
402 //fill in first name
403 $this->type('first_name', $firstName);
404
405 //fill in last name
406 $lastName = "Smith_" . substr(sha1(rand()), 0, 7);;
407 $this->type('last_name', $lastName);
408
409 //fill in email
410 $email = substr(sha1(rand()), 0, 7) . "john@gmail.com";
411 $this->type('email_1_email', $email);
412
413 // Clicking save.
414 $this->click('_qf_Contact_upload_view');
415 $this->waitForPageToLoad($this->getTimeoutMsec());
416
417 $this->assertTrue($this->isTextPresent("$firstName $lastName has been created."));
418
419 // click through to the membership view screen
420 $this->click('css=li#tab_member a');
421
422 $this->waitForElementPresent('link=Add Membership');
423 $this->click('link=Add Membership');
424
425 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
426
427 // fill in Membership Organization and Type
428 $this->select('membership_type_id[0]', "label=Organization {$title}");
429 // Wait for membership type select to reload
430 $this->waitForTextPresent("Membership Type {$title}");
431 $this->select('membership_type_id[1]', "label=Membership Type {$title}");
432
433
434 $sourceText = "Membership ContactAddTest with Fixed Membership Type Scenario 3";
435 // fill in Source
436 $this->type('source', $sourceText);
437
438 //build the membership dates.
439 require_once 'CRM/Core/Config.php';
440 require_once 'CRM/Utils/Array.php';
441 require_once 'CRM/Utils/Date.php';
442 $currentYear = date('Y');
443 $currentMonth = date('m');
444 $previousYear = $currentYear - 1;
445 $nextYear = $currentYear + 1;
446 $todayDate = date('Y-m-d');
447 $joinDate = date('Y-m-d', mktime(0, 0, 0, 11, 15, $currentYear));
448 $startDate = date('Y-m-d', mktime(0, 0, 0, 1, 1, $currentYear));
449 $endDate = date('Y-m-d', mktime(0, 0, 0, 12, 31, $nextYear));
450 $configVars = new CRM_Core_Config_Variables();
451 foreach (array(
452 'joinDate', 'startDate', 'endDate') as $date) {
453 $$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
454 }
455
456 $query = "
457 SELECT end_event_adjust_interval
458 FROM civicrm_membership_status
459 WHERE start_event = 'join_date'
460 AND name = 'New'";
461 $endInterval = CRM_Core_DAO::singleValueQuery($query);
462
463 // Add endInterval to Nov 15 (join date month above) to get end of New status period
464 $endNewStatus = date('Y-m-d', mktime(0, 0, 0, $endInterval - 1, 15, $nextYear));
465
466 $status = 'Current';
467 // status will be 'New' if today is >= join date and <= endNewStatus date
468 if ((strtotime($todayDate) >= strtotime($joinDate)) && (strtotime($todayDate) <= strtotime($endNewStatus))) {
469 $status = 'New';
470 }
471
472 // fill in Join Date
473 $this->webtestFillDate('join_date', $joinDate);
474
475 // Clicking save.
476 $this->click('_qf_Membership_upload');
477 $this->waitForPageToLoad($this->getTimeoutMsec());
478
479 // page was loaded
480 $this->waitForTextPresent($sourceText);
481
482 // Is status message correct?
483 $this->assertTrue($this->isTextPresent("Membership Type $title membership for $firstName $lastName has been added."),
484 "Status message didn't show up after saving!"
485 );
486
487 // click through to the membership view screen
488 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
489 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
490
491 $this->webtestVerifyTabularData(
492 array(
493 'Membership Type' => "Membership Type {$title}",
494 'Status' => $status,
495 'Source' => $sourceText,
496 'Member Since' => $joinDate,
497 'Start date' => $startDate,
498 'End date' => $endDate,
499 )
500 );
501 }
502
503 function testMembershipTypeScenario4() {
504 // Scenario 4
505 // Standard Fixed scenario - Jan 1 Fixed Period Start and October 31 rollover
506 // Join Date is earlier than Rollover Date
507
508
509 // Log in using webtestLogin() method
510 $this->webtestLogin();
511
512 $this->openCiviPage("contact/add", "reset=1&ct=Organization", '_qf_Contact_cancel');
513
514 $title = substr(sha1(rand()), 0, 7);
515 $this->type('organization_name', "Organization $title");
516 $this->type('email_1_email', "$title@org.com");
517 $this->click('_qf_Contact_upload_view');
518 $this->waitForPageToLoad($this->getTimeoutMsec());
519
520 $this->assertTrue($this->isTextPresent("Organization $title has been created."));
521
522 $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse");
523
524 $this->click("link=Add Membership Type");
525 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
526
527 $this->type('name', "Membership Type $title");
528 $this->type('member_of_contact', $title);
529 $this->click('member_of_contact');
530 $this->waitForElementPresent("css=div.ac_results-inner li");
531 $this->click("css=div.ac_results-inner li");
532
533 $this->type('minimum_fee', '100');
534 $this->select( 'financial_type_id', 'value=2' );
535 $this->type('duration_interval', 1);
536 $this->select('duration_unit', "label=year");
537
538 $this->select('period_type', "label=fixed");
539 $this->waitForElementPresent('fixed_period_rollover_day[d]');
540
541 $this->select('fixed_period_start_day[M]', 'value=1');
542 $this->select('fixed_period_rollover_day[M]', 'value=10');
543 $this->select('fixed_period_rollover_day[d]', 'value=31');
544
545 $this->click('relationship_type_id', 'value=4_b_a');
546
547 $this->click('_qf_MembershipType_upload-bottom');
548 $this->waitForElementPresent('link=Add Membership Type');
549 $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved."));
550
551 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
552
553 $firstName = "John_" . substr(sha1(rand()), 0, 7);
554
555 //fill in first name
556 $this->type('first_name', $firstName);
557
558 //fill in last name
559 $lastName = "Smith_" . substr(sha1(rand()), 0, 7);;
560 $this->type('last_name', $lastName);
561
562 //fill in email
563 $email = substr(sha1(rand()), 0, 7) . "john@gmail.com";
564 $this->type('email_1_email', $email);
565
566 // Clicking save.
567 $this->click('_qf_Contact_upload_view');
568 $this->waitForPageToLoad($this->getTimeoutMsec());
569
570 $this->assertTrue($this->isTextPresent("$firstName $lastName has been created."));
571
572 // click through to the membership view screen
573 $this->click('css=li#tab_member a');
574
575 $this->waitForElementPresent('link=Add Membership');
576 $this->click('link=Add Membership');
577
578 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
579
580 // fill in Membership Organization and Type
581 $this->select('membership_type_id[0]', "label=Organization $title");
582 $this->select('membership_type_id[1]', "label=Membership Type $title");
583
584 $sourceText = "Membership ContactAddTest with Fixed Membership Type Scenario 4";
585 // fill in Source
586 $this->type('source', $sourceText);
587
588 //build the membership dates.
589 require_once 'CRM/Core/Config.php';
590 require_once 'CRM/Utils/Array.php';
591 require_once 'CRM/Utils/Date.php';
592 $currentYear = date('Y');
593 $currentMonth = date('m');
594 $nextYear = $currentYear + 1;
595 $todayDate = date('Y-m-d');
596
597 // the member-since date we will type in to membership form
598 $joinDate = date('Y-m-d', mktime(0, 0, 0, 1, 15, $currentYear));
599
600 // expected calc'd start and end dates
601 $startDate = date('Y-m-d', mktime(0, 0, 0, 1, 1, $currentYear));
602 $endDate = date('Y-m-d', mktime(0, 0, 0, 12, 31, $currentYear));
603 $configVars = new CRM_Core_Config_Variables();
604 foreach (array(
605 'joinDate', 'startDate', 'endDate') as $date) {
606 $$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
607 }
608
609 $query = "
610 SELECT end_event_adjust_interval
611 FROM civicrm_membership_status
612 WHERE start_event = 'join_date'
613 AND name = 'New'";
614 $endInterval = CRM_Core_DAO::singleValueQuery($query);
615
616 // Add endInterval to Jan 6 (join date month above) to get end of New status period
617 $endNewStatus = date('Y-m-d', mktime(0, 0, 0, $endInterval + 1, 15, $currentYear));
618
619 $status = 'Current';
620 // status will be 'New' if today is >= join date and <= endNewStatus date
621 if ((strtotime($todayDate) >= strtotime($joinDate)) && (strtotime($todayDate) <= strtotime($endNewStatus))) {
622 $status = 'New';
623 }
624
625 // fill in Join Date
626 $this->webtestFillDate('join_date', $joinDate);
627
628 // Clicking save.
629 $this->click('_qf_Membership_upload');
630 $this->waitForPageToLoad($this->getTimeoutMsec());
631
632 // page was loaded
633 $this->waitForTextPresent($sourceText);
634
635 // Is status message correct?
636 $this->assertTrue($this->isTextPresent("Membership Type $title membership for $firstName $lastName has been added."),
637 "Status message didn't show up after saving!"
638 );
639
640 // click through to the membership view screen
641 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
642 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
643
644 $this->webtestVerifyTabularData(
645 array(
646 'Membership Type' => "Membership Type $title",
647 'Status' => $status,
648 'Source' => $sourceText,
649 'Member Since' => $joinDate,
650 'Start date' => $startDate,
651 'End date' => $endDate,
652 )
653 );
654 }
655 }
656