| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC. All rights reserved. | |
| 6 | | | |
| 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 | |
| 10 | +--------------------------------------------------------------------+ |
| 11 | */ |
| 12 | |
| 13 | /** |
| 14 | * |
| 15 | * @package CRM |
| 16 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 17 | */ |
| 18 | |
| 19 | use Civi\Api4\Event; |
| 20 | |
| 21 | /** |
| 22 | * @group headless |
| 23 | */ |
| 24 | class 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() { |
| 32 | Event::create()->setValues(['template_title' => 'Big Event', 'is_template' => 1, 'start_date' => 'now', 'event_type_id' => 'Meeting'])->execute(); |
| 33 | Event::create()->setValues(['title' => 'Bigger Event', 'start_date' => 'now', 'event_type_id' => 'Meeting'])->execute(); |
| 34 | $this->assertEquals(1, Event::get()->selectRowCount()->execute()->count()); |
| 35 | } |
| 36 | |
| 37 | } |