Merge pull request #17943 from jitendrapurohit/core-1906
[civicrm-core.git] / tests / phpunit / api / v4 / Action / EventTest.php
CommitLineData
57b75c5c 1<?php
2
3/*
4 +--------------------------------------------------------------------+
7d61e75f 5 | Copyright CiviCRM LLC. All rights reserved. |
57b75c5c 6 | |
7d61e75f
TO
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 |
57b75c5c 10 +--------------------------------------------------------------------+
11 */
12
13/**
14 *
15 * @package CRM
ca5cec67 16 * @copyright CiviCRM LLC https://civicrm.org/licensing
57b75c5c 17 */
18
19use Civi\Api4\Event;
20
21/**
22 * @group headless
23 */
24class EventTest extends \api\v4\UnitTestCase {
25
26 /**
27 * Test that the event api filters out templates by default.
28 *
29 * @throws \Civi\API\Exception\UnauthorizedException
30 */
31 public function testTemplateFilterByDefault() {
10619fd1
CW
32 $t = Event::create()->setValues(['template_title' => 'Big Event', 'is_template' => 1, 'start_date' => 'now', 'event_type_id:name' => 'Meeting'])->execute()->first();
33 $e = Event::create()->setValues(['title' => 'Bigger Event', 'start_date' => 'now', 'event_type_id:name' => 'Meeting'])->execute()->first();
34 $result = (array) Event::get()->execute()->column('id');
35 $this->assertContains($e['id'], $result);
36 $this->assertNotContains($t['id'], $result);
57b75c5c 37 }
38
39}