Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-07-23-17-12-38
[civicrm-core.git] / tests / phpunit / api / v3 / ACLCachingTest.php
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
29 require_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
38 class api_v3_ACLCachingTest extends CiviUnitTestCase {
39 protected $_apiversion;
40 protected $_params;
41
42 public $_eNoticeCompliant = TRUE;
43
44 function setUp() {
45 $this->_apiversion = 3;
46
47 parent::setUp();
48
49 }
50 /**
51 * (non-PHPdoc)
52 * @see CiviUnitTestCase::tearDown()
53 */
54 function tearDown() {
55 $tablesToTruncate = array(
56 'civicrm_activity',
57 );
58 $this->quickCleanup($tablesToTruncate, TRUE);
59 }
60
61 function testActivityCreateCustomBefore() {
62 $values = civicrm_api('custom_field', 'getoptions', array('field' => 'custom_group_id', 'version' => 3));
63 $this->assertTrue($values['count'] == 0);
64 $this->CustomGroupCreate('Activity', 'cachingtest');
65 $groupCount = civicrm_api('custom_group', 'getcount', array('version' => 3, 'extends' => 'activity'));
66 $this->assertEquals($groupCount, 1, 'one group should now exist');
67 $values = civicrm_api('custom_field', 'getoptions', array('field' => 'custom_group_id', 'version' => 3));
68 $this->assertTrue($values['count'] == 1, 'check that cached value is not retained for custom_group_id');
69 }
70 }
71