4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 namespace api\v
4\Entity
;
21 use api\v
4\UnitTestCase
;
22 use Civi\Api4\Navigation
;
23 use Civi\Test\TransactionalInterface
;
28 class NavigationTest
extends UnitTestCase
implements TransactionalInterface
{
30 public function testCreate() {
31 $created = Navigation
::create(FALSE)
32 ->addValue('permission', ['administer CiviCRM', 'access CiviCRM'])
33 ->addValue('name', 'Test menu item')
34 ->execute()->single();
36 $fetched = Navigation
::get(FALSE)
37 ->addWhere('id', '=', $created['id'])
38 ->execute()->single();
40 $this->assertEquals(['administer CiviCRM', 'access CiviCRM'], $created['permission']);
41 $this->assertEquals(\CRM_Core_Config
::domainID(), $fetched['domain_id']);
42 $this->assertGreaterThan(0, $fetched['weight']);