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