function create($contributionPageId) { $profileParams = array('group_type' => 'Individual,Contact', 'title' => 'Test Supprorter Profile', 'help_pre' => 'Profle to PCP Contribution', 'is_active' => 1, 'is_cms_user' => 2); $ufGroup = civicrm_uf_group_create($profileParams); $profileId = $ufGroup['id']; $fieldsParams = array(array('field_name' => 'first_name', 'field_type' => 'Individual', 'visibility' => 'Public Pages and Listings', 'weight' => 1, 'label' => 'First Name', 'is_required' => 1, 'is_active' => 1), array('field_name' => 'last_name', 'field_type' => 'Individual', 'visibility' => 'Public Pages and Listings', 'weight' => 2, 'label' => 'Last Name', 'is_required' => 1, 'is_active' => 1), array('field_name' => 'email', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', 'weight' => 3, 'label' => 'Email', 'is_required' => 1, 'is_active' => 1)); foreach ($fieldsParams as $value) { $ufField = civicrm_uf_field_create($profileId, $value); } $joinParams = array('module' => 'Profile', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $profileId, 'is_active' => 1); require_once 'api/v2/UFJoin.php'; $ufJoin = civicrm_uf_join_add($joinParams); $params = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $contributionPageId, 'supporter_profile_id' => $profileId, 'is_approval_needed' => 0, 'is_tellfriend_enabled' => 0, 'tellfriend_limit' => 0, 'link_text' => 'Create your own Personal Campaign Page!', 'is_active' => 1, 'notify_email' => '*****@*****.**'); require_once 'CRM/Contribute/BAO/PCP.php'; $blockPCP = CRM_Contribute_BAO_PCP::add($params); return array('blockId' => $blockPCP->id, 'profileId' => $profileId); }
/** * find uf join group id */ public function testFindUFGroupId() { $params = array('module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $this->_ufGroupId, 'is_active' => 1); $ufJoin = civicrm_uf_join_add($params); $searchParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => 1); $ufGroupId = civicrm_uf_join_UFGroupId_find($searchParams); $this->assertEquals($ufGroupId, $this->_ufGroupId); }
/** * test buildCustomDisplay() method */ function testbuildCustomDisplay() { $this->markTestSkipped('throws fatals'); $fieldsParams = array(array('field_name' => 'first_name', 'field_type' => 'Individual', 'visibility' => 'Public Pages and Listings', 'weight' => 1, 'label' => 'First Name', 'is_required' => 1, 'is_active' => 1), array('field_name' => 'last_name', 'field_type' => 'Individual', 'visibility' => 'Public Pages and Listings', 'weight' => 2, 'label' => 'Last Name', 'is_required' => 1, 'is_active' => 1), array('field_name' => 'email', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', 'weight' => 3, 'label' => 'Email', 'is_required' => 1, 'is_active' => 1)); foreach ($fieldsParams as $value) { $ufField = civicrm_uf_field_create($profileId, $value); } $joinParams = array('module' => 'Profile', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $profileId, 'is_active' => 1); require_once 'api/v2/UFJoin.php'; $ufJoin = civicrm_uf_join_add($joinParams); $params = array('title' => 'Test Cotribution Page', 'contribution_type_id' => $this->_contributionTypeID, 'is_active' => 1, 'custom_post_id' => $profileId); require_once 'CRM/Contribute/BAO/ContributionPage.php'; $contributionpage = CRM_Contribute_BAO_ContributionPage::create($params, $ids); $id = $contributionpage->id; $values = array(); }