Merge pull request #17612 from eileenmcnaughton/format
[civicrm-core.git] / tests / phpunit / CRM / Case / BAO / QueryTest.php
CommitLineData
96dc1ce0 1<?php
0eea664b 2
96dc1ce0 3/**
4 * Include dataProvider for tests
acb109b7 5 * @group headless
96dc1ce0 6 */
7class CRM_Case_BAO_QueryTest extends CiviUnitTestCase {
8
9 /**
10 * Set up function.
11 *
12 * Ensure CiviCase is enabled.
13 */
14 public function setUp() {
15 parent::setUp();
16 CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
17 }
18
19 /**
20 * Check that Qill is calculated correctly.
21 *
22 * CRM-17120 check the qill is still calculated after changing function used
23 * to retrieve function.
24 *
25 * Note that the Qill doesn't actually appear to have the correct labels to
26 * start with. I didn't attempt to fix that. I just prevented regression.
27 *
28 * I could not find anyway to actually do this search with the relevant fields
29 * as parameters & don't know if they exist as legitimate code or code cruft so
30 * this test was the only way I could verify the change.
31 * - case_recent_activity_type
32 * - case_activity_status_id
33 * - case_activity_medium_id
34 */
35 public function testWhereClauseSingle() {
9099cab3
CW
36 $params = [
37 0 => [
96dc1ce0 38 0 => 'case_recent_activity_type',
39 1 => '=',
40 2 => 6,
41 3 => 1,
42 4 => 0,
9099cab3
CW
43 ],
44 1 => [
96dc1ce0 45 0 => 'case_activity_status_id',
46 1 => '=',
47 2 => 1,
48 3 => 1,
49 4 => 0,
9099cab3
CW
50 ],
51 2 => [
96dc1ce0 52 0 => 'case_activity_medium_id',
53 1 => '=',
54 2 => 1,
55 3 => 1,
56 4 => 0,
9099cab3
CW
57 ],
58 ];
96dc1ce0 59
60 $queryObj = new CRM_Contact_BAO_Query($params, NULL, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CASE);
39b9dbb3 61 $this->assertEquals(
9099cab3 62 [
39b9dbb3
TO
63 0 => 'Activity Type = Contribution',
64 1 => 'Activity Type = Scheduled',
65 2 => 'Activity Medium = In Person',
9099cab3 66 ],
39b9dbb3 67 $queryObj->_qill[1]
96dc1ce0 68 );
69 }
43321dd5 70
96dc1ce0 71}