3 namespace api\v
4\Action
;
5 use api\v
4\UnitTestCase
;
6 use Civi\Api4\Activity
;
11 * This class tests a series of complex query situations described in the
12 * initial APIv4 specification
14 class ComplexQueryTest
extends UnitTestCase
{
16 public function setUpHeadless() {
19 'civicrm_activity_contact',
21 $this->cleanup(['tablesToTruncate' => $relatedTables]);
22 $this->loadDataSet('DefaultDataSet');
24 return parent
::setUpHeadless();
28 * Fetch all phone call activities
29 * Expects at least one activity loaded from the data set.
31 public function testGetAllHousingSupportActivities() {
32 $results = Activity
::get()
33 ->setCheckPermissions(FALSE)
34 ->addWhere('activity_type.name', '=', 'Phone Call')
37 $this->assertGreaterThan(0, count($results));
41 * Fetch all activities with a blue tag; and return all tags on the activities
43 public function testGetAllTagsForBlueTaggedActivities() {
48 * Fetch contacts named 'Bob' and all of their blue activities
50 public function testGetAllBlueActivitiesForBobs() {
55 * Get all contacts in a zipcode and return their Home or Work email addresses
57 public function testGetHomeOrWorkEmailsForContactsWithZipcode() {
62 * Fetch all activities where Bob is the assignee or source
64 public function testGetActivitiesWithBobAsAssigneeOrSource() {
69 * Get all contacts which
70 * (a) have address in zipcode 94117 or 94118 or in city "San Francisco","LA"
72 * (b) are not deceased and
73 * (c) have a custom-field "most_important_issue=Environment".
75 public function testAWholeLotOfConditions() {
80 * Get participants who attended CiviCon 2012 but not CiviCon 2013.
81 * Return their name and email.
83 public function testGettingNameAndEmailOfAttendeesOfCiviCon2012Only() {