Merge pull request #17203 from artfulrobot/artfulrobot-cleanup-job-improvements
[civicrm-core.git] / tests / phpunit / api / v4 / Action / ComplexQueryTest.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
6 | |
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 +--------------------------------------------------------------------+
11 */
12
13 /**
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 * $Id$
18 *
19 */
20
21
22 namespace api\v4\Action;
23
24 use api\v4\UnitTestCase;
25 use Civi\Api4\Activity;
26
27 /**
28 * @group headless
29 *
30 * This class tests a series of complex query situations described in the
31 * initial APIv4 specification
32 */
33 class ComplexQueryTest extends UnitTestCase {
34
35 public function setUpHeadless() {
36 $relatedTables = [
37 'civicrm_activity',
38 'civicrm_activity_contact',
39 ];
40 $this->cleanup(['tablesToTruncate' => $relatedTables]);
41 $this->loadDataSet('DefaultDataSet');
42
43 return parent::setUpHeadless();
44 }
45
46 /**
47 * Fetch all phone call activities
48 * Expects at least one activity loaded from the data set.
49 */
50 public function testGetAllHousingSupportActivities() {
51 $results = Activity::get()
52 ->setCheckPermissions(FALSE)
53 ->addWhere('activity_type_id:name', '=', 'Phone Call')
54 ->execute();
55
56 $this->assertGreaterThan(0, count($results));
57 }
58
59 /**
60 * Fetch all activities with a blue tag; and return all tags on the activities
61 */
62 public function testGetAllTagsForBlueTaggedActivities() {
63
64 }
65
66 /**
67 * Fetch contacts named 'Bob' and all of their blue activities
68 */
69 public function testGetAllBlueActivitiesForBobs() {
70
71 }
72
73 /**
74 * Get all contacts in a zipcode and return their Home or Work email addresses
75 */
76 public function testGetHomeOrWorkEmailsForContactsWithZipcode() {
77
78 }
79
80 /**
81 * Fetch all activities where Bob is the assignee or source
82 */
83 public function testGetActivitiesWithBobAsAssigneeOrSource() {
84
85 }
86
87 /**
88 * Get all contacts which
89 * (a) have address in zipcode 94117 or 94118 or in city "San Francisco","LA"
90 * and
91 * (b) are not deceased and
92 * (c) have a custom-field "most_important_issue=Environment".
93 */
94 public function testAWholeLotOfConditions() {
95
96 }
97
98 /**
99 * Get participants who attended CiviCon 2012 but not CiviCon 2013.
100 * Return their name and email.
101 */
102 public function testGettingNameAndEmailOfAttendeesOfCiviCon2012Only() {
103
104 }
105
106 }