Merge pull request #1216 from davecivicrm/CRM-13062
[civicrm-core.git] / tests / phpunit / api / v3 / ACLCachingTest.php
CommitLineData
d2fc9254 1<?php
2
3/*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.3 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29require_once 'CiviTest/CiviUnitTestCase.php';
30
31/**
32 * This class is intended to test ACL permission using the multisite module
33 *
34 * @package CiviCRM_APIv3
35 * @subpackage API_Contact
36 */
37
38class api_v3_ACLCachingTest extends CiviUnitTestCase {
f6722559 39 protected $_apiversion = 3;
d2fc9254 40 protected $_params;
d2fc9254 41 public $_eNoticeCompliant = TRUE;
4e420887 42 public $DBResetRequired = FALSE;
d2fc9254 43
44 function setUp() {
d2fc9254 45 parent::setUp();
d2fc9254 46 }
47/**
48 * (non-PHPdoc)
49 * @see CiviUnitTestCase::tearDown()
50 */
51 function tearDown() {
52 $tablesToTruncate = array(
53 'civicrm_activity',
54 );
55 $this->quickCleanup($tablesToTruncate, TRUE);
56 }
57
58 function testActivityCreateCustomBefore() {
f6722559 59 $values = $this->callAPISuccess('custom_field', 'getoptions', array('field' => 'custom_group_id',));
d2fc9254 60 $this->assertTrue($values['count'] == 0);
f6722559 61 $this->CustomGroupCreate(array('extends' => 'Activity'));
62 $groupCount = $this->callAPISuccess('custom_group', 'getcount', array('extends' => 'activity'));
d2fc9254 63 $this->assertEquals($groupCount, 1, 'one group should now exist');
f6722559 64 $values = $this->callAPISuccess('custom_field', 'getoptions', array('field' => 'custom_group_id'));
d2fc9254 65 $this->assertTrue($values['count'] == 1, 'check that cached value is not retained for custom_group_id');
66 }
67}
68