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
22 namespace api\v
4\Action
;
24 use api\v
4\UnitTestCase
;
25 use Civi\Api4\Activity
;
30 * This class tests a series of complex query situations described in the
31 * initial APIv4 specification
33 class ComplexQueryTest
extends UnitTestCase
{
35 public function setUpHeadless() {
38 'civicrm_activity_contact',
40 $this->cleanup(['tablesToTruncate' => $relatedTables]);
41 $this->loadDataSet('DefaultDataSet');
43 return parent
::setUpHeadless();
47 * Fetch all phone call activities
48 * Expects at least one activity loaded from the data set.
50 public function testGetAllHousingSupportActivities() {
51 $results = Activity
::get()
52 ->setCheckPermissions(FALSE)
53 ->addWhere('activity_type.name', '=', 'Phone Call')
56 $this->assertGreaterThan(0, count($results));
60 * Fetch all activities with a blue tag; and return all tags on the activities
62 public function testGetAllTagsForBlueTaggedActivities() {
67 * Fetch contacts named 'Bob' and all of their blue activities
69 public function testGetAllBlueActivitiesForBobs() {
74 * Get all contacts in a zipcode and return their Home or Work email addresses
76 public function testGetHomeOrWorkEmailsForContactsWithZipcode() {
81 * Fetch all activities where Bob is the assignee or source
83 public function testGetActivitiesWithBobAsAssigneeOrSource() {
88 * Get all contacts which
89 * (a) have address in zipcode 94117 or 94118 or in city "San Francisco","LA"
91 * (b) are not deceased and
92 * (c) have a custom-field "most_important_issue=Environment".
94 public function testAWholeLotOfConditions() {
99 * Get participants who attended CiviCon 2012 but not CiviCon 2013.
100 * Return their name and email.
102 public function testGettingNameAndEmailOfAttendeesOfCiviCon2012Only() {