Api4 - Support wildcard * in select clause
[civicrm-core.git] / tests / phpunit / api / v4 / Query / Api4SelectQueryComplexJoinTest.php
index 6b5acd0dabc3d01278244777688e29ed52be264d..3b08d4577c42f26c8576ffe7646da6750b6b86d1 100644 (file)
@@ -2,34 +2,18 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
  */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
  * $Id$
  *
  */
@@ -65,7 +49,7 @@ class Api4SelectQueryComplexJoinTest extends UnitTestCase {
     $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name'));
     $query->select[] = 'id';
     $query->select[] = 'display_name';
-    $query->select[] = 'phones.phone';
+    $query->select[] = 'phones.*_id';
     $query->select[] = 'emails.email';
     $query->select[] = 'emails.location_type.name';
     $query->select[] = 'created_activities.contact_id';
@@ -91,6 +75,11 @@ class Api4SelectQueryComplexJoinTest extends UnitTestCase {
     $this->assertArrayHasKey('activity_type', $firstActivity);
     $activityType = $firstActivity['activity_type'];
     $this->assertArrayHasKey('name', $activityType);
+
+    $this->assertArrayHasKey('name', $firstResult['emails'][0]['location_type']);
+    $this->assertArrayHasKey('location_type_id', $firstResult['phones'][0]);
+    $this->assertArrayHasKey('id', $firstResult['phones'][0]);
+    $this->assertArrayNotHasKey('phone', $firstResult['phones'][0]);
   }
 
   public function testWithSelectOfOrphanDeepValues() {