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\Api4TestBase
;
23 use Civi\Test\TransactionalInterface
;
28 class DomainTest
extends Api4TestBase
implements TransactionalInterface
{
30 public function testActiveDomain() {
32 ->addValue('name', 'Not current')
33 ->addValue('version', \CRM_Utils_System
::version())
37 ->addValue('name', 'Currently the current domain')
38 ->addWhere('is_active', '=', TRUE)
41 $getCurrent = Domain
::get(FALSE)
42 ->addWhere('is_active', '=', TRUE)
43 ->execute()->single();
45 $this->assertEquals('Currently the current domain', $getCurrent['name']);
47 $getAll = Domain
::get(FALSE)
48 ->addSelect('*', 'is_active')
49 ->execute()->indexBy('name');
51 $this->assertTrue($getAll['Currently the current domain']['is_active']);
52 $this->assertFalse($getAll['Not current']['is_active']);