* @package CiviCRM_APIv3
* @subpackage API_Core
*/
-
class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
protected $_apiversion = 3;
public function setUp() {
parent::setUp();
$this->enableCiviCampaign();
- $this->toBeImplemented['get'] = array('Profile', 'CustomValue', 'Constant', 'CustomSearch', 'Extension', 'ReportTemplate', 'System', 'Setting');
- $this->toBeImplemented['create'] = array('SurveyRespondant', 'OptionGroup', 'MailingRecipients', 'UFMatch', 'LocationType', 'CustomSearch', 'Extension', 'ReportTemplate', 'System');
- $this->toBeImplemented['delete'] = array('MembershipPayment', 'OptionGroup', 'SurveyRespondant', 'UFJoin', 'UFMatch', 'Extension', 'LocationType', 'System');
- $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain','Setting');
+ $this->toBeImplemented['get'] = array(
+ 'Profile',
+ 'CustomValue',
+ 'Constant',
+ 'CustomSearch',
+ 'Extension',
+ 'ReportTemplate',
+ 'System',
+ 'Setting'
+ );
+ $this->toBeImplemented['create'] = array(
+ 'SurveyRespondant',
+ 'OptionGroup',
+ 'MailingRecipients',
+ 'UFMatch',
+ 'LocationType',
+ 'CustomSearch',
+ 'Extension',
+ 'ReportTemplate',
+ 'System'
+ );
+ $this->toBeImplemented['delete'] = array(
+ 'MembershipPayment',
+ 'OptionGroup',
+ 'SurveyRespondant',
+ 'UFJoin',
+ 'UFMatch',
+ 'Extension',
+ 'LocationType',
+ 'System'
+ );
+ $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain', 'Setting');
$this->deprecatedAPI = array('Location', 'ActivityType', 'SurveyRespondant');
$this->deletableTestObjects = array();
}
$tmp = civicrm_api('Entity', 'Get', array('version' => 3));
if (getenv('SYNTAX_CONFORMANCE_ENTITIES')) {
$tmp = array(
- 'values' => explode(' ', getenv('SYNTAX_CONFORMANCE_ENTITIES'))
+ 'values' => explode(' ', getenv('SYNTAX_CONFORMANCE_ENTITIES')),
);
}
public static function entities_getSqlOperators() {
return static::entities(static::toBeSkipped_getSqlOperators());
}
+
/**
* @return array
*/
public static function entities_getfields() {
return static::entities(static::toBeSkipped_getfields(TRUE));
}
+
/**
* @return array
*/
$customDataEntities = array();
$invalidEntities = array('Individual', 'Organization', 'Household');
$entitiesToFix = array('Case', 'Relationship');
- foreach ($entities as $entityName => $entity ) {
- if(!in_array($entityName, $invalidEntities)
- && !in_array($entityName, $entitiesToFix)) {
- if(!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) {
- CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]);
- }
- $customDataEntities[] = array($entityName);
+ foreach ($entities as $entityName => $entity) {
+ if (!in_array($entityName, $invalidEntities)
+ && !in_array($entityName, $entitiesToFix)
+ ) {
+ if (!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) {
+ CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]);
+ }
+ $customDataEntities[] = array($entityName);
}
}
return $customDataEntities;
* @return array
*/
public static function toBeSkipped_get($sequential = FALSE) {
- $entitiesWithoutGet = array('MailingEventSubscribe', 'MailingEventConfirm', 'MailingEventResubscribe', 'MailingEventUnsubscribe', 'Location');
+ $entitiesWithoutGet = array(
+ 'MailingEventSubscribe',
+ 'MailingEventConfirm',
+ 'MailingEventResubscribe',
+ 'MailingEventUnsubscribe',
+ 'Location'
+ );
if ($sequential === TRUE) {
return $entitiesWithoutGet;
}
/**
* Mailing Contact Just doesn't support id. We have always insisted on finding a way to
- * support id in API but in this case the underlying tables are crying out for a restructue
- * & it just doesn't make sense
+ * support id in API but in this case the underlying tables are crying out for a restructure
+ * & it just doesn't make sense, on the otherhand Event need id to be existant as pseudo property
+ * is been associated with it, so we need to bypass for get api otherwise it will through pseudo_match validation
*
- * @param bool|\unknown_type $sequential
+ * @param bool $sequential
*
- * @return multitype:string |multitype:multitype:string
+ * @return array
+ * Entities that cannot be retrieved by ID
*/
public static function toBeSkipped_getByID($sequential = FALSE) {
- return array('MailingContact');
+ return array('MailingContact', 'Event');
}
/**
* @return array
*/
public static function toBeSkipped_delete($sequential = FALSE) {
- $entitiesWithout = array('MailingContact', 'MailingEventConfirm', 'MailingEventResubscribe', 'MailingEventSubscribe', 'MailingEventUnsubscribe', 'MailingRecipients', 'Constant', 'Entity', 'Location', 'Domain', 'Profile', 'CustomValue', 'Setting');
+ $entitiesWithout = array(
+ 'MailingContact',
+ 'MailingEventConfirm',
+ 'MailingEventResubscribe',
+ 'MailingEventSubscribe',
+ 'MailingEventUnsubscribe',
+ 'MailingRecipients',
+ 'Constant',
+ 'Entity',
+ 'Location',
+ 'Domain',
+ 'Profile',
+ 'CustomValue',
+ 'Setting'
+ );
if ($sequential === TRUE) {
return $entitiesWithout;
}
public static function toBeSkipped_getfields($sequential = FALSE) {
$entitiesWithMetadataNotYetFixed = array('ReportTemplate', 'CustomSearch');
if ($sequential === TRUE) {
- return $entitiesWithMetadataNotYetFixed ;
+ return $entitiesWithMetadataNotYetFixed;
}
$entities = array();
foreach ($entitiesWithMetadataNotYetFixed as $e) {
}
return $entities;
}
-/**
- * Generate list of entities to test for get by id functions
- * @param boolean $sequential
- * @return multitype:string |multitype:multitype:string
- */
+
+ /**
+ * Generate list of entities to test for get by id functions
+ * @param bool $sequential
+ * @return array
+ * Entities to be skipped
+ */
public static function toBeSkipped_automock($sequential = FALSE) {
- $entitiesWithoutGet = array('MailingContact', 'EntityTag', 'Participant', 'ParticipantPayment', 'Setting', 'SurveyRespondant', 'MailingRecipients', 'CustomSearch', 'Extension', 'ReportTemplate', 'System');
+ $entitiesWithoutGet = array(
+ 'MailingContact',
+ 'EntityTag',
+ 'Participant',
+ 'ParticipantPayment',
+ 'Setting',
+ 'SurveyRespondant',
+ 'MailingRecipients',
+ 'CustomSearch',
+ 'Extension',
+ 'ReportTemplate',
+ 'System'
+ );
if ($sequential === TRUE) {
return $entitiesWithoutGet;
}
/**
- * At this stage exclude the ones that don't pass & add them as we can troubleshoot them
- */
+ * At this stage exclude the ones that don't pass & add them as we can troubleshoot them
+ */
public static function toBeSkipped_updatesingle($sequential = FALSE) {
$entitiesWithout = array(
- 'Attachment', // pseudo-entity; testUpdateSingleValueAlter doesn't introspect properly on it. Multiple magic fields
+ 'Attachment',
+ // pseudo-entity; testUpdateSingleValueAlter doesn't introspect properly on it. Multiple magic fields
'Mailing',
'MailingGroup',
'MailingJob',
'PaymentProcessor',
'Setting',
'MailingContact',
- 'SystemLog' //skip this because it doesn't make sense to update logs
+ 'SystemLog'
+ //skip this because it doesn't make sense to update logs,
);
if ($sequential === TRUE) {
return $entitiesWithout;
*/
public static function toBeSkipped_getlimit() {
$entitiesWithout = array(
- 'Case',//case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id)
- 'EntityTag', // non-standard api - has inappropriate mandatory fields & doesn't implement limit
- 'Event', // failed 'check that a 5 limit returns 5' - probably is_template field is wrong or something, or could be limit doesn't work right
- 'Extension', // can't handle creating 25
- 'Note', // fails on 5 limit - probably a set up problem
- 'Setting', //a bit of a pseudoapi - keys by domain
+ 'Case',
+ //case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id)
+ 'EntityTag',
+ // non-standard api - has inappropriate mandatory fields & doesn't implement limit
+ 'Event',
+ // failed 'check that a 5 limit returns 5' - probably is_template field is wrong or something, or could be limit doesn't work right
+ 'Extension',
+ // can't handle creating 25
+ 'Note',
+ // fails on 5 limit - probably a set up problem
+ 'Setting',
+ //a bit of a pseudoapi - keys by domain
);
return $entitiesWithout;
}
*/
public static function toBeSkipped_getSqlOperators() {
$entitiesWithout = array(
- 'Case',//case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id)
+ 'Case', //case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id)
'Contact', // on the todo list!
'EntityTag', // non-standard api - has inappropriate mandatory fields & doesn't implement limit
'Extension', // can't handle creating 25
*
* @return array
*/
- public function getKnownUnworkablesUpdateSingle($entity, $key){
+ public function getKnownUnworkablesUpdateSingle($entity, $key) {
// can't update values are values for which updates don't result in the value being changed
$knownFailures = array(
'ActionSchedule' => array(
),
'ActivityContact' => array(
'cant_update' => array(
- 'activity_id', //we have an FK on activity_id + contact_id + record id so if we don't leave this one distinct we get an FK constraint error
+ 'activity_id',
+ //we have an FK on activity_id + contact_id + record id so if we don't leave this one distinct we get an FK constraint error
),
),
'Address' => array(
'cant_update' => array(
'state_province_id', //issues with country id - need to ensure same country
- 'master_id',//creates relationship
+ 'master_id', //creates relationship
),
- 'cant_return' => array(
- )
+ 'cant_return' => array(),
),
'Batch' => array(
'cant_update' => array(
),
'cant_return' => array(
'entity_table',
- )
+ ),
),
'CaseType' => array(
'cant_update' => array(
'definition',
- )
+ ),
),
'MembershipBlock' => array(
'cant_update' => array(
// The fake/auto-generated values leave us unable to properly cleanup fake data
'entity_type',
'entity_id',
- )
+ ),
+ ),
+ 'ContributionSoft' => array(
+ 'cant_update' => array(
+ // can't be changed through api
+ 'pcp_id',
+ ),
),
'Pledge' => array(
'cant_update' => array(
'installments',
'original_installment_amount',
'next_pay_date',
- 'amount' // can't be changed through API
+ 'amount' // can't be changed through API,
),
'break_return' => array(// if these are passed in they are retrieved from the wrong table
'honor_contact_id',
'contribution_page_id',
'financial_account_id',
'financial_type_id',
- 'currency'
+ 'currency',
),
'cant_return' => array(// can't be retrieved from api
'honor_type_id', //due to uniquename missing
'pledge_status_id',
'pledge_campaign_id',
'pledge_financial_type_id',
- )
+ ),
),
'PaymentProcessorType' => array(
'cant_update' => array(
'billing_mode',
),
- 'break_return' => array(
- ),
- 'cant_return' => array(
- ),
+ 'break_return' => array(),
+ 'cant_return' => array(),
),
'PriceFieldValue' => array(
'cant_update' => array(
),
),
);
- if(empty($knownFailures[$entity]) || empty($knownFailures[$entity][$key])){
+ if (empty($knownFailures[$entity]) || empty($knownFailures[$entity][$key])) {
return array();
}
return $knownFailures[$entity][$key];
/**
* @dataProvider toBeSkipped_get
- entities that don't need a get action
+ entities that don't need a get action
*/
public function testNotImplemented_get($Entity) {
$result = civicrm_api($Entity, 'Get', array('version' => 3));
$this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__);
// $this->assertContains("API ($Entity, Get) does not exist", $result['error_message']);
- $this->assertRegExp('/API (.*) does not exist/', $result['error_message']);
+ $this->assertRegExp('/API (.*) does not exist/', $result['error_message']);
}
/**
$this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__);
$this->assertContains("Mandatory key(s) missing from params array", $result['error_message']);
}
+
/**
* @dataProvider entities_get
*/
$this->assertEquals(2000, $result['error_code']);
$this->assertEquals('Input variable `params` is not an array', $result['error_message']);
}
+
/**
* @dataProvider entities_get
* @Xdepends testEmptyParam_get // no need to test the simple if the empty doesn't work/is skipped. doesn't seem to work
// big random number. fun fact: if you multiply it by pi^e, the result is another random number, but bigger ;)
$nonExistantID = 30867307034;
if (in_array($Entity, $this->toBeImplemented['get'])
- || in_array($Entity, $this->toBeSkipped_getByID())
+ || in_array($Entity, $this->toBeSkipped_getByID())
) {
return;
}
* @dataProvider entities_getlimit
*
* @param string $entityName
- *
*/
public function testLimit($entityName) {
$cases = array(); // each case is array(0 => $inputtedApiOptions, 1 => $expectedResultCount)
$this->checkLimitAgainstExpected($entityName, $case[0], $case[1], $case[2]);
//non preferred / legacy syntax
- if(isset($case[0]['options']['limit'])) {
+ if (isset($case[0]['options']['limit'])) {
$this->checkLimitAgainstExpected($entityName, array('rowCount' => $case[0]['options']['limit']), $case[1], $case[2]);
$this->checkLimitAgainstExpected($entityName, array('option_limit' => $case[0]['options']['limit']), $case[1], $case[2]);
$this->checkLimitAgainstExpected($entityName, array('option.limit' => $case[0]['options']['limit']), $case[1], $case[2]);
* @dataProvider entities_getSqlOperators
*
* @param string $entityName
- *
*/
public function testSqlOperators($entityName) {
$baoString = _civicrm_api3_get_BAO($entityName);
/**
* Check that get fetches an appropriate number of results
*
- * @param string $entityName Name of entity to test
+ * @param string $entityName
+ * Name of entity to test.
* @param array $params
- * @param integer $limit
+ * @param int $limit
* @param string $message
*/
public function checkLimitAgainstExpected($entityName, $params, $limit, $message) {
$result = $this->callAPISuccess($entityName, 'get', $params);
- if($limit == 30) {
+ if ($limit == 30) {
$this->assertGreaterThanOrEqual($limit, $result['count'], $message);
$this->assertGreaterThanOrEqual($limit, $result['count'], $message);
}
$this->assertEquals($limit, count($result['values']), $message);
}
}
+
/**
* Create two entities and make sure we can fetch them individually by ID (e.g. using "contact_id=>2"
* or "group_id=>4")
return;
}
-
$this->assertArrayHasKey('version', $result);
$this->assertEquals(3, $result['version']);
if (!in_array($Entity, $this->onlyIDNonZeroCount['get'])) {
/**
* @dataProvider toBeSkipped_create
- entities that don't need a create action
+ entities that don't need a create action
*/
public function testNotImplemented_create($Entity) {
$result = civicrm_api($Entity, 'Create', array('version' => 3));
$this->markTestIncomplete("fixing this test to test the api functions fails on numberous tests
which will either create a completely blank entity (batch, participant status) or
have a damn good crack at it (e.g mailing job). Marking this as incomplete beats false success");
- //
return;
if (in_array($Entity, $this->toBeImplemented['create'])) {
// $this->markTestIncomplete("civicrm_api3_{$Entity}_create to be implemented");
$this->assertNotEmpty($baoString, $entityName);
$this->assertNotEmpty($entityName, $entityName);
$fieldsGet = $fields = $this->callAPISuccess($entityName, 'getfields', array('action' => 'get'));
- if($entityName != 'Pledge'){
+ if ($entityName != 'Pledge') {
$fields = $this->callAPISuccess($entityName, 'getfields', array('action' => 'create'));
}
$fields = $fields['values'];
$return = array_keys($fieldsGet['values']);
$valuesNotToReturn = $this->getKnownUnworkablesUpdateSingle($entityName, 'break_return');
- // these can't be requested as return values
+ // these can't be requested as return values
$entityValuesThatDoNotWork = array_merge(
- $this->getKnownUnworkablesUpdateSingle($entityName, 'cant_update'),
- $this->getKnownUnworkablesUpdateSingle($entityName, 'cant_return'),
- $valuesNotToReturn
- );
+ $this->getKnownUnworkablesUpdateSingle($entityName, 'cant_update'),
+ $this->getKnownUnworkablesUpdateSingle($entityName, 'cant_return'),
+ $valuesNotToReturn
+ );
- $return = array_diff($return,$valuesNotToReturn);
+ $return = array_diff($return, $valuesNotToReturn);
$baoObj = new CRM_Core_DAO();
$baoObj->createTestObject($baoString, array('currency' => 'USD'), 2, 0);
$fieldName = $specs['uniquename'];
}
if ($field == 'currency' || $field == 'id' || $field == strtolower($entityName) . '_id'
- || in_array($field,$entityValuesThatDoNotWork)) {
+ || in_array($field, $entityValuesThatDoNotWork)
+ ) {
//@todo id & entity_id are correct but we should fix currency & frequency_day
continue;
}
case CRM_Utils_Type::T_TIMESTAMP:
$entity[$fieldName] = '2012-05-20';
break;
+
//case CRM_Utils_Type::T_DATETIME:
case 12:
case CRM_Utils_Type::T_TEXT:
case CRM_Utils_Type::T_LONGTEXT:
case CRM_Utils_Type::T_EMAIL:
- $entity[$fieldName] = substr('New String',0, CRM_Utils_Array::Value('maxlength',$specs,100));
+ $entity[$fieldName] = substr('New String', 0, CRM_Utils_Array::Value('maxlength', $specs, 100));
break;
case CRM_Utils_Type::T_INT:
$entity[$fieldName] = 2;
}
elseif (!empty($specs['FKClassName'])) {
- if($specs['FKClassName'] == $baoString){
+ if ($specs['FKClassName'] == $baoString) {
$entity[$fieldName] = (string) $entity2['id'];
}
- else{
+ else {
$uniqueName = CRM_Utils_Array::value('uniqueName', $specs);
if (!empty($entity[$fieldName])) {
$resetFKTo = array($fieldName => $entity[$fieldName]);
}
$entity[$fieldName] = (string) empty($entity2[$field]) ? CRM_Utils_Array::value($uniqueName, $entity2) : $entity2[$field];
- //todo - there isn't always something set here - & our checking on unset values is limited
+ //todo - there isn't always something set here - & our checking on unset values is limited
if (empty($entity[$field])) {
unset($entity[$field]);
}
$options = $this->callAPISuccess($entityName, 'getoptions', array('context' => 'create', 'field' => $field));
if (empty($options['values'])) {
//eg. pdf_format id doesn't ship with any
- if(isset($specs['pseudoconstant']['optionGroupName'])) {
- $optionGroupID = $this->callAPISuccess('option_group', 'getvalue', array('name' => 'pdf_format', 'return' => 'id'));
- $optionValue = $this->callAPISuccess('option_value', 'create', array('option_group_id' => $optionGroupID, 'label' => 'new option value'));
+ if (isset($specs['pseudoconstant']['optionGroupName'])) {
+ $optionGroupID = $this->callAPISuccess('option_group', 'getvalue', array(
+ 'name' => 'pdf_format',
+ 'return' => 'id'
+ ));
+ $optionValue = $this->callAPISuccess('option_value', 'create', array(
+ 'option_group_id' => $optionGroupID,
+ 'label' => 'new option value'
+ ));
$options['values'][] = $optionValue['id'];
}
}
'id' => $entity['id'],
$field => isset($entity[$field]) ? $entity[$field] : NULL,
);
- if(isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
+ if (isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
//api has special handling on these 2 fields for backward compatibility reasons
$entity['contribution_type_id'] = $updateParams['financial_type_id'];
}
);
$checkEntity = $this->callAPISuccess($entityName, 'getsingle', $checkParams);
- $this->assertAPIArrayComparison($entity, $checkEntity, array(), "checking if $fieldName was correctly updated\n" . print_r(array('update-params' => $updateParams, 'update-result' => $update, 'getsingle-params' => $checkParams, 'getsingle-result' => $checkEntity, 'expected entity' => $entity), TRUE));
+ $this->assertAPIArrayComparison($entity, $checkEntity, array(), "checking if $fieldName was correctly updated\n" . print_r(array(
+ 'update-params' => $updateParams,
+ 'update-result' => $update,
+ 'getsingle-params' => $checkParams,
+ 'getsingle-result' => $checkEntity,
+ 'expected entity' => $entity
+ ), TRUE));
if ($resetFKTo) {
//reset the foreign key fields because otherwise our cleanup routine fails & some other unexpected stuff can kick in
$entity = array_merge($entity, $resetFKTo);
$updateParams = array_merge($updateParams, $resetFKTo);
$this->callAPISuccess($entityName, 'create', $updateParams);
- if(isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
+ if (isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
//api has special handling on these 2 fields for backward compatibility reasons
$entity['contribution_type_id'] = $updateParams['financial_type_id'];
}
/**
* @dataProvider toBeSkipped_delete
- entities that don't need a delete action
+ entities that don't need a delete action
*/
public function testNotImplemented_delete($Entity) {
$nonExistantID = 151416349;
$this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__);
$this->assertContains("Mandatory key(s) missing from params array", $result['error_message']);
}
+
/**
* @dataProvider entities_delete
*/
}
$result = $this->callAPIFailure($Entity, 'Delete', array('id' => 999));
}
+
/**
* @dataProvider entities
*/
$this->callAPISuccess($entityName, 'delete', array('id' => $baoObj2->id));
//make sure 1 less exists now
$result = $this->callAPISuccess($entityName, 'getcount', array(),
- ($createcount + $startCount) -1
+ ($createcount + $startCount) - 1
);
//make sure id #1 exists
* Create two entities and make sure delete action only deletes one!
*
* @dataProvider entities_getfields
- *
*/
public function testGetfieldsHasTitle($entity) {
$entities = $this->getEntitiesSupportingCustomFields();
if (in_array($entity, $entities)) {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, $entity . 'Test.php');
}
- $actions = $this->callAPISuccess($entity, 'getactions', array());
+ $actions = $this->callAPISuccess($entity, 'getactions', array());
foreach ($actions['values'] as $action) {
- if (substr($action, -7) == '_create' || substr($action, -4) == '_get' || substr($action, -7) == '_delete') {
+ if (substr($action, -7) == '_create' || substr($action, -4) == '_get' || substr($action, -7) == '_delete') {
//getactions can't distinguish between contribution_page.create & contribution_page.create
continue;
}
}
return $returnEntities;
}
+
/**
* @param string $entityName
* @param int $count
*
- *
* @return array
*/
private function getMockableBAOObjects($entityName, $count = 2) {
$baoString = _civicrm_api3_get_BAO($entityName);
if (empty($baoString)) {
$this->markTestIncomplete("Entity [$entityName] cannot be mocked - no known DAO");
- return;
+ return array();
}
$baos = array();
$i = 0;
- while($i < $count) {
- // create entities
+ while ($i < $count) {
+ // create entities
$baoObj = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD'));
$this->assertTrue(is_integer($baoObj->id), 'check first id');
$this->deletableTestObjects[$baoString][] = $baoObj->id;
$baos[] = $baoObj;
- $i ++;
+ $i++;
}
return $baos;
}
// Verify that chaining handles decoding
$chainResult = $this->callAPISuccess('Event', 'Get', array(
'id' => $eventId,
- 'api.event.get' => array(
- ),
+ 'api.event.get' => array(),
));
$this->assertEquals('CiviCRM <> TheRest', $chainResult['values'][$eventId]['title']);
$this->assertEquals('TheRest <> CiviCRM', $chainResult['values'][$eventId]['description']);
));
//$this->assertTrue((bool)$setValueDescriptionResult['is_error']); // not supported by setValue
$this->assertEquals('setValueDescription: TheRest <> CiviCRM', $setValueDescriptionResult['values']['description']);
-}
+ }
/**
* Verify that write operations (create/update) use partial HTML-encoding
$this->assertAPISuccess($createResult);
$eventId = $createResult['id'];
$this->assertDBQuery('createNew: CiviCRM <> TheRest', 'SELECT title FROM civicrm_event WHERE id = %1', array(
- 1 => array($eventId, 'Integer')
+ 1 => array($eventId, 'Integer'),
));
$this->assertDBQuery('createNew: TheRest <> CiviCRM', 'SELECT description FROM civicrm_event WHERE id = %1', array(
- 1 => array($eventId, 'Integer')
+ 1 => array($eventId, 'Integer'),
));
// Verify that "create" handles encoding for updates
));
$this->assertAPISuccess($createWithIdResult);
$this->assertDBQuery('createWithId: CiviCRM <> TheRest', 'SELECT title FROM civicrm_event WHERE id = %1', array(
- 1 => array($eventId, 'Integer')
+ 1 => array($eventId, 'Integer'),
));
$this->assertDBQuery('createWithId: TheRest <> CiviCRM', 'SELECT description FROM civicrm_event WHERE id = %1', array(
- 1 => array($eventId, 'Integer')
+ 1 => array($eventId, 'Integer'),
));
// Verify that "setvalue" handles encoding for updates
));
$this->assertAPISuccess($setValueTitleResult);
$this->assertDBQuery('setValueTitle: CiviCRM <> TheRest', 'SELECT title FROM civicrm_event WHERE id = %1', array(
- 1 => array($eventId, 'Integer')
+ 1 => array($eventId, 'Integer'),
));
$setValueDescriptionResult = civicrm_api('Event', 'setvalue', array(
'version' => 3,
//$this->assertTrue((bool)$setValueDescriptionResult['is_error']); // not supported by setValue
$this->assertAPISuccess($setValueDescriptionResult);
$this->assertDBQuery('setValueDescription: TheRest <> CiviCRM', 'SELECT description FROM civicrm_event WHERE id = %1', array(
- 1 => array($eventId, 'Integer')
+ 1 => array($eventId, 'Integer'),
));
}
}