<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
- * Test class for UFGroup API - civicrm_uf_*
- *
- * @todo Split UFGroup and UFJoin tests
+ * Test class for UFField API
*
* @package CiviCRM
* @group headless
/**
* Create / updating field.
+ * @param int $version
+ * @dataProvider versionThreeAndFour
*/
- public function testCreateUFField() {
+ public function testCreateUFField($version) {
+ $this->_apiversion = $version;
$params = $this->_params;
$ufField = $this->callAPIAndDocument('uf_field', 'create', $params, __FUNCTION__, __FILE__);
unset($params['uf_group_id']);
/**
* Failure test for field_name.
+ * @param int $version
+ * @dataProvider versionThreeAndFour
*/
- public function testCreateUFFieldWithBadFieldName() {
+ public function testCreateUFFieldWithBadFieldName($version) {
+ $this->_apiversion = $version;
$params = $this->_params;
$params['field_name'] = 'custom_98789';
$this->callAPIFailure('uf_field', 'create', $params);
/**
* Failure test for bad parameters.
+ * @param int $version
+ * @dataProvider versionThreeAndFour
*/
- public function testCreateUFFieldWithWrongParams() {
+ public function testCreateUFFieldWithWrongParams($version) {
+ $this->_apiversion = $version;
$this->callAPIFailure('uf_field', 'create', ['field_name' => 'test field']);
$this->callAPIFailure('uf_field', 'create', ['label' => 'name-less field']);
}
* Create a field with 'weight=1' and then a second with 'weight=1'.
*
* The second field winds up with weight=1, and the first field gets bumped to 'weight=2'.
+ * @param int $version
+ * @dataProvider versionThreeAndFour
*/
- public function testCreateUFFieldWithDefaultAutoWeight() {
+ public function testCreateUFFieldWithDefaultAutoWeight($version) {
+ $this->_apiversion = $version;
$params1 = $this->_params;
$ufField1 = $this->callAPISuccess('uf_field', 'create', $params1);
$this->assertEquals(1, $ufField1['values'][$ufField1['id']]['weight']);
/**
* Deleting field.
+ * @param int $version
+ * @dataProvider versionThreeAndFour
*/
- public function testDeleteUFField() {
+ public function testDeleteUFField($version) {
+ $this->_apiversion = $version;
$ufField = $this->callAPISuccess('uf_field', 'create', $this->_params);
$params = [
'field_id' => $ufField['id'],
/**
* Test getting ufField.
+ * @param int $version
+ * @dataProvider versionThreeAndFour
*/
- public function testGetUFFieldSuccess() {
+ public function testGetUFFieldSuccess($version) {
+ $this->_apiversion = $version;
$this->callAPISuccess($this->_entity, 'create', $this->_params);
$result = $this->callAPIAndDocument($this->_entity, 'get', [], __FUNCTION__, __FILE__);
$this->getAndCheck($this->_params, $result['id'], $this->_entity);
/**
* Check Profile API permission without ACL.
+ * @param int $version
+ * @dataProvider versionThreeAndFour
*/
- public function testProfilesWithoutACL() {
+ public function testProfilesWithoutACL($version) {
+ $this->_apiversion = $version;
$this->createLoggedInUser();
$baseFields[] = [
'field_name' => 'first_name',