Merge pull request #13890 from aydun/joomla#6
[civicrm-core.git] / tests / phpunit / CRM / Event / BAO / QueryTest.php
1 <?php
2
3 /**
4 * @group headless
5 */
6 class CRM_Event_BAO_QueryTest extends CiviUnitTestCase {
7
8 public function setUp() {
9 parent::setUp();
10 }
11
12 public function testParticipantNote() {
13 $event = $this->eventCreate();
14 $this->individualCreate([
15 'api.participant.create' => [
16 'event_id' => $event['id'],
17 'note' => 'some_note',
18 ],
19 ]);
20 $this->individualCreate([
21 'api.participant.create' => [
22 'event_id' => $event['id'],
23 'note' => 'some_other_note',
24 ],
25 ]);
26 $params = [
27 [
28 0 => 'participant_note',
29 1 => '=',
30 2 => 'some_note',
31 3 => 1,
32 4 => 0,
33 ],
34 ];
35
36 $query = new CRM_Contact_BAO_Query($params, NULL, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTACTS);
37 $sql = $query->query(FALSE);
38 $result = CRM_Core_DAO::executeQuery(implode(' ', $sql));
39 $this->assertEquals(1, $result->N);
40 }
41
42 }