Merge pull request #17294 from agh1/sr-rel-perms
[civicrm-core.git] / tests / phpunit / api / v3 / ProductTest.php
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 * Class api_v3_ProductTest
14 * @group headless
15 */
16 class api_v3_ProductTest extends CiviUnitTestCase {
17 protected $_apiversion = 3;
18 protected $_params;
19
20 protected $_entity = 'Product';
21
22 public function setUp() {
23 parent::setUp();
24 $this->useTransaction();
25 $this->_params = [
26 'name' => 'my product',
27 ];
28 }
29
30 public function testGetFields() {
31 $fields = $this->callAPISuccess($this->_entity, 'getfields', ['action' => 'create']);
32 $this->assertArrayHasKey('period_type', $fields['values']);
33 }
34
35 public function testGetOptions() {
36 $options = $this->callAPISuccess($this->_entity, 'getoptions', ['field' => 'period_type']);
37 $this->assertArrayHasKey('rolling', $options['values']);
38 }
39
40 }