/**
* Emulate a logged in user since certain functions use that.
* value to store a record in the DB (like activity)
+ *
* @see https://issues.civicrm.org/jira/browse/CRM-8180
*
* @return int
* Contact ID of the created user.
+ * @throws \CiviCRM_API3_Exception
*/
- public function createLoggedInUser() {
+ public function createLoggedInUser(): int {
$params = [
'first_name' => 'Logged In',
'last_name' => 'User ' . rand(),
*
* @return int
* id of Organisation created
+ *
+ * @throws \CiviCRM_API3_Exception
*/
- public function organizationCreate($params = [], $seq = 0) {
+ public function organizationCreate($params = [], $seq = 0): int {
if (!$params) {
$params = [];
}
* @return int
* id of Individual created
*
- * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function individualCreate($params = [], $seq = 0, $random = FALSE) {
+ public function individualCreate($params = [], $seq = 0, $random = FALSE): int {
$params = array_merge($this->sampleContact('Individual', $seq, $random), $params);
return $this->_contactCreate($params);
}
*
* @throws \CiviCRM_API3_Exception
*/
- private function _contactCreate($params) {
+ private function _contactCreate($params): int {
$result = civicrm_api3('contact', 'create', $params);
return (int) $result['id'];
}