Skip to content
Snippets Groups Projects
Unverified Commit 8723cead authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub
Browse files

Merge pull request #15419 from eileenmcnaughton/event_filter

financial#72 Make is_template=0 the default for api get requests.
parents 187fc9e9 57b75c5c
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,11 @@ class GetActionDefaultsProvider implements Generic\SpecProviderInterface {
if ($isTestField) {
$isTestField->setDefaultValue('0');
}
$isTemplateField = $spec->getFieldByName('is_template');
if ($isTemplateField) {
$isTemplateField->setDefaultValue('0');
}
}
/**
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
*/
use Civi\Api4\Event;
/**
* @group headless
*/
class EventTest extends \api\v4\UnitTestCase {
/**
* Test that the event api filters out templates by default.
*
* @throws \Civi\API\Exception\UnauthorizedException
*/
public function testTemplateFilterByDefault() {
Event::create()->setValues(['template_title' => 'Big Event', 'is_template' => 1, 'start_date' => 'now', 'event_type_id' => 'Meeting'])->execute();
Event::create()->setValues(['title' => 'Bigger Event', 'start_date' => 'now', 'event_type_id' => 'Meeting'])->execute();
$this->assertEquals(1, Event::get()->selectRowCount()->execute()->count());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment