| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'CiviTest/CiviUnitTestCase.php';
*/
class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->loadAllFixtures();
* Assure CRM_Core_PseudoConstant::get() is working properly for a range of
* DAO fields having a <pseudoconstant> tag in the XML schema.
*/
- function testOptionValues() {
+ public function testOptionValues() {
// Create a custom field group for testing.
$custom_group_name = md5(microtime());
'html_type' => 'Select',
'data_type' => 'String',
'is_active' => TRUE,
- 'option_values' => array(array(
- 'label' => 'Foo',
- 'value' => 'foo',
- 'is_active' => 1,
- 'weight' => 0,
- )),
+ 'option_values' => array(
+ array(
+ 'label' => 'Foo',
+ 'value' => 'foo',
+ 'is_active' => 1,
+ 'weight' => 0,
+ ),
+ ),
);
$result = civicrm_api3('custom_field', 'create', $api_params);
$customFieldId = $result['id'];
'sample' => 'Unsupervised',
),
),
- 'CRM_Mailing_Event_DAO_Subscribe' => array(
- array(
- 'fieldName' => 'group_id',
- 'sample' => $group_name,
- ),
- ),
'CRM_Activity_DAO_Activity' => array(
array(
'fieldName' => 'activity_type_id',
'sample' => $campaign_name,
),
),
- 'CRM_Pledge_DAO_PledgePayment' => array(
+ 'CRM_Pledge_DAO_PledgePayment' => array(
array(
'fieldName' => 'currency',
'sample' => array('USD' => 'US Dollar'),
}
}
- function testContactTypes() {
+ public function testContactTypes() {
$byName = array(
'Individual' => 'Individual',
'Household' => 'Household',
$result = CRM_Contact_DAO_Contact::buildOptions('contact_type');
$this->assertEquals($byName, $result);
// But we can also fetch by ID
- $result = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'contact_type', array('keyColumn' => 'id', 'labelColumn' => 'name'));
+ $result = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'contact_type', array(
+ 'keyColumn' => 'id',
+ 'labelColumn' => 'name',
+ ));
$this->assertEquals($byId, $result);
// Make sure flip param works
- $result = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'contact_type', array('keyColumn' => 'id', 'labelColumn' => 'name', 'flip' => TRUE));
+ $result = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'contact_type', array(
+ 'keyColumn' => 'id',
+ 'labelColumn' => 'name',
+ 'flip' => TRUE,
+ ));
$this->assertEquals(array_flip($byId), $result);
}
+
}