| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 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 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * This class is intended to test ACL permission using the multisite module |
| 14 | * |
| 15 | * @package CiviCRM_APIv3 |
| 16 | * @subpackage API_Contact |
| 17 | * @group headless |
| 18 | */ |
| 19 | class api_v3_ACLCachingTest extends CiviUnitTestCase { |
| 20 | protected $_params; |
| 21 | |
| 22 | public $DBResetRequired = FALSE; |
| 23 | |
| 24 | public function setUp() { |
| 25 | parent::setUp(); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * (non-PHPdoc) |
| 30 | * @see CiviUnitTestCase::tearDown() |
| 31 | */ |
| 32 | public function tearDown() { |
| 33 | $tablesToTruncate = [ |
| 34 | 'civicrm_activity', |
| 35 | ]; |
| 36 | $this->quickCleanup($tablesToTruncate, TRUE); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @param int $version |
| 41 | * @dataProvider versionThreeAndFour |
| 42 | */ |
| 43 | public function testActivityCreateCustomBefore($version) { |
| 44 | $this->_apiversion = $version; |
| 45 | $values = $this->callAPISuccess('custom_field', 'getoptions', ['field' => 'custom_group_id']); |
| 46 | $this->assertTrue($values['count'] == 0); |
| 47 | $this->CustomGroupCreate(['extends' => 'Activity']); |
| 48 | $groupCount = $this->callAPISuccess('custom_group', 'getcount', ['extends' => 'activity']); |
| 49 | $this->assertEquals($groupCount, 1, 'one group should now exist'); |
| 50 | $values = $this->callAPISuccess('custom_field', 'getoptions', ['field' => 'custom_group_id']); |
| 51 | $this->assertTrue($values['count'] == 1, 'check that cached value is not retained for custom_group_id'); |
| 52 | } |
| 53 | |
| 54 | } |