Merge pull request #4909 from pratikshad/broken-webtest
[civicrm-core.git] / tests / phpunit / api / v3 / ACLCachingTest.php
CommitLineData
d2fc9254 1<?php
2
3/*
4 +--------------------------------------------------------------------+
39de6fd5 5 | CiviCRM version 4.6 |
d2fc9254 6 +--------------------------------------------------------------------+
06a1bc01 7 | Copyright CiviCRM LLC (c) 2004-2014 |
d2fc9254 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 *
6c6e6187
TO
34 * @package CiviCRM_APIv3
35 * @subpackage API_Contact
d2fc9254 36 */
d2fc9254 37class api_v3_ACLCachingTest extends CiviUnitTestCase {
f6722559 38 protected $_apiversion = 3;
d2fc9254 39 protected $_params;
b7c9bc4c 40
4e420887 41 public $DBResetRequired = FALSE;
d2fc9254 42
00be9182 43 public function setUp() {
d2fc9254 44 parent::setUp();
d2fc9254 45 }
5896d037 46
6c6e6187
TO
47 /**
48 * (non-PHPdoc)
49 * @see CiviUnitTestCase::tearDown()
50 */
00be9182 51 public function tearDown() {
d2fc9254 52 $tablesToTruncate = array(
53 'civicrm_activity',
54 );
55 $this->quickCleanup($tablesToTruncate, TRUE);
56 }
57
00be9182 58 public function testActivityCreateCustomBefore() {
6c6e6187 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}