Update Unit test styling to cover the future coder version
[civicrm-core.git] / tests / phpunit / CRMTraits / PCP / PCPTestTrait.php
CommitLineData
e40ce31e
JM
1<?php
2/*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
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 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 +--------------------------------------------------------------------+
26 */
27
28/**
29 * Trait CRMTraits_PCP_PCPTestTrait
30 *
31 * Traits for testing PCP pages.
32 */
33trait CRMTraits_PCP_PCPTestTrait {
39b959db 34
e40ce31e
JM
35 /**
36 * Build and return pcpBlock params.
37 *
38 * Create the necessary initial objects for a pcpBlock, then return the
39 * params needed to create the pcpBlock.
40 *
41 */
42 public function pcpBlockParams() {
43 $contribPage = CRM_Core_DAO::createTestObject('CRM_Contribute_DAO_ContributionPage');
44 $contribPageId = $contribPage->id;
45 $supporterProfile = CRM_Core_DAO::createTestObject('CRM_Core_DAO_UFGroup');
46 $supporterProfileId = $supporterProfile->id;
47
48 $params = array(
49 'entity_table' => 'civicrm_contribution_page',
50 'entity_id' => $contribPageId,
51 'supporter_profile_id' => $supporterProfileId,
52 'target_entity_id' => 1,
53 'is_approval_needed' => 1,
54 'is_tellfriend_enabled' => 1,
55 'tellfriend_limit' => 1,
56 'link_text' => 'Create your own PCP',
57 'is_active' => 1,
58 );
59
60 return $params;
61 }
62
63 /**
64 * Build and return pcp params.
65 *
66 * Create the necessary initial objects for a pcp page, then return the
67 * params needed to create the pcp page.
68 */
69 public function pcpParams() {
70 $contact = CRM_Core_DAO::createTestObject('CRM_Contact_DAO_Contact');
71 $contactId = $contact->id;
72 $contribPage = CRM_Core_DAO::createTestObject('CRM_Contribute_DAO_ContributionPage');
73 $contribPageId = $contribPage->id;
74
75 $params = array(
76 'contact_id' => $contactId,
77 'status_id' => '1',
78 'title' => 'My PCP',
79 'intro_text' => 'Hey you, contribute now!',
80 'page_text' => 'You better give more.',
81 'donate_link_text' => 'Donate Now',
82 'page_id' => $contribPageId,
83 'is_thermometer' => 1,
84 'is_honor_roll' => 1,
85 'goal_amount' => 10000.00,
86 'is_active' => 1,
87 );
88
89 return $params;
90 }
91
92}