3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * Class CRM_Member_BAO_MembershipTest
33 class CRM_Member_Selector_SearchTest
extends CiviUnitTestCase
{
36 * Test results from getRows.
38 * @throws \CRM_Core_Exception
40 public function testSelectorGetRows() {
41 $this->_contactID
= $this->individualCreate();
42 $this->_invoiceID
= 1234;
43 $this->_contributionPageID
= NULL;
44 $this->_paymentProcessorID
= $this->paymentProcessorCreate();
45 $this->setupMembershipRecurringPaymentProcessorTransaction();
46 $membership = $this->callAPISuccessGetSingle('Membership', ['contact_id' => $this->_contactID
]);
47 $membershipID = $membership['id'];
49 $selector = new CRM_Member_Selector_Search($params);
50 $rows = $selector->getRows(CRM_Core_Permission
::VIEW
, 0, 25, NULL);
52 'contact_id' => $this->_contactID
,
53 'membership_id' => $membershipID,
54 'contact_type' => '<a href="/index.php?q=civicrm/profile/view&reset=1&gid=7&id=' . $this->_contactID
. '&snippet=4" class="crm-summary-link"><div class="icon crm-icon Individual-icon"></div></a>',
55 'sort_name' => 'Anderson, Anthony',
56 'membership_type' => 'General',
57 'membership_join_date' => date('Y-m-d'),
58 'membership_start_date' => date('Y-m-d'),
59 'membership_end_date' => $membership['end_date'],
60 'membership_source' => 'Payment',
61 'member_is_test' => '0',
62 'owner_membership_id' => NULL,
63 'membership_status' => 'New',
64 'member_campaign_id' => NULL,
66 'campaign_id' => NULL,
67 'checkbox' => 'mark_x_1',
68 'action' => '<span><a href="/index.php?q=civicrm/contact/view/membership&reset=1&id=1&cid=' . $this->_contactID
. '&action=view&context=search&selectedChild=member&compContext=membership" class="action-item crm-hover-button" title=\'View Membership\' >View</a><a href="/index.php?q=civicrm/contact/view/membership&reset=1&action=update&id=' . $membershipID . '&cid=' . $this->_contactID
. '&context=search&compContext=membership" class="action-item crm-hover-button" title=\'Edit Membership\' >Edit</a></span><span class=\'btn-slide crm-hover-button\'>Renew...<ul class=\'panel\'><li><a href="/index.php?q=civicrm/contact/view/membership&reset=1&action=delete&id=' . $membershipID . '&cid=' . $this->_contactID
. '&context=search&compContext=membership" class="action-item crm-hover-button small-popup" title=\'Delete Membership\' >Delete</a></li><li><a href="/index.php?q=civicrm/contact/view/membership&reset=1&action=renew&id=' . $membershipID . '&cid=' . $this->_contactID
. '&context=search&compContext=membership" class="action-item crm-hover-button" title=\'Renew Membership\' >Renew</a></li><li><a href="/index.php?q=civicrm/contribute/unsubscribe&reset=1&mid=' . $membershipID . '&context=search&compContext=membership" class="action-item crm-hover-button" title=\'Cancel Auto Renew Subscription\' >Cancel Auto-renewal</a></li></ul></span>',
71 $this->assertCount(1, $rows);