3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * Test APIv3 civicrm_user_* functions
15 * @package CiviCRM_APIv3
16 * @subpackage API_Contact
19 class api_v3_UserTest
extends CiviUnitTestCase
{
20 protected $_apiversion = 3;
22 protected $_entity = 'User';
25 public $DBResetRequired = FALSE;
27 public function setUp() {
29 $this->contactID
= $this->createLoggedInUser();
31 'contact_id' => $this->contactID
,
36 public function testUserGet() {
37 $result = $this->callAPIAndDocument($this->_entity
, 'get', $this->params
, __FUNCTION__
, __FILE__
);
38 $this->assertEquals(1, $result['count']);
39 $this->assertEquals($this->contactID
, $result['values'][0]['contact_id']);
40 $this->assertEquals(6, $result['values'][0]['id']);
41 $this->assertEquals('superman', $result['values'][0]['name']);
45 * Test retrieval of label metadata.
47 public function testGetFields() {
48 $result = $this->callAPIAndDocument($this->_entity
, 'getfields', ['action' => 'get'], __FUNCTION__
, __FILE__
);
49 $this->assertArrayKeyExists('name', $result['values']);