Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
justinfreeman (Agileware)
Core
Commits
e790a8cb
Commit
e790a8cb
authored
11 years ago
by
vivekarora
Committed by
totten
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Code review for schedule reminders
parent
477c4acd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/v3/ActionSchedule.php
+90
-0
90 additions, 0 deletions
api/v3/ActionSchedule.php
tests/phpunit/api/v3/ActionScheduleTest.php
+85
-0
85 additions, 0 deletions
tests/phpunit/api/v3/ActionScheduleTest.php
with
175 additions
and
0 deletions
api/v3/ActionSchedule.php
0 → 100644
+
90
−
0
View file @
e790a8cb
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*/
/**
* File for the CiviCRM APIv3 for Scheduled Reminders
*
* @package CiviCRM_APIv3
* @subpackage API_ActionSchedule
*
* @copyright CiviCRM LLC (c) 2004-2013
*
*/
/**
* Get CiviCRM Action Schedule details
* {@getfields action_schedule_create}
*
*/
function
civicrm_api3_action_schedule_get
(
$params
)
{
$bao
=
new
CRM_Core_BAO_ActionSchedule
();
_civicrm_api3_dao_set_filter
(
$bao
,
$params
,
true
,
'ActionSchedule'
);
$actionSchedules
=
_civicrm_api3_dao_to_array
(
$bao
,
$params
,
true
,
'ActionSchedule'
);
return
civicrm_api3_create_success
(
$actionSchedules
,
$params
,
'action_schedule'
,
'get'
,
$bao
);
}
/**
* Create a new Action Schedule
*
* @param array $params
*
* @return array
*
* {@getfields action_schedule_create}
*/
function
civicrm_api3_action_schedule_create
(
$params
)
{
return
_civicrm_api3_basic_create
(
_civicrm_api3_get_BAO
(
__FUNCTION__
),
$params
);
}
/**
* Adjust Metadata for Create action
*
* The metadata is used for setting defaults, documentation & validation
* @param array $params array or parameters determined by getfields
*/
function
_civicrm_api3_action_schedule_create_spec
(
&
$params
)
{
unset
(
$params
[
'version'
]);
}
/**
* delete an existing action_schedule
*
*
* @param array $params (reference) array containing id of the action_schedule
* to be deleted
*
* @return array (referance) returns flag true if successfull, error
* message otherwise
*
* @access public
*/
function
civicrm_api3_action_schedule_delete
(
$params
)
{
return
_civicrm_api3_basic_delete
(
_civicrm_api3_get_BAO
(
__FUNCTION__
),
$params
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/phpunit/api/v3/ActionScheduleTest.php
0 → 100644
+
85
−
0
View file @
e790a8cb
<?php
/**
* File for the TestActionSchedule class
*
* (PHP 5)
*
* CiviCRM is free software; you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* 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 along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
/**
* Include class definitions
*/
require_once
'CiviTest/CiviUnitTestCase.php'
;
/**
* Test APIv3 civicrm_action_schedule functions
*
* @package CiviCRM_APIv3
* @subpackage API_ActionSchedule
*/
class
api_v3_ActionScheduleTest
extends
CiviUnitTestCase
{
protected
$_params
;
protected
$_params2
;
protected
$_entity
=
'action_schedule'
;
protected
$_apiversion
=
3
;
public
$_eNoticeCompliant
=
TRUE
;
/**
* Test setup for every test
*
* Connect to the database, truncate the tables that will be used
* and redirect stdin to a temporary file
*/
public
function
setUp
()
{
// Connect to the database
parent
::
setUp
();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
*/
function
tearDown
()
{
$tablesToTruncate
=
array
(
'civicrm_action_schedule'
,
);
$this
->
quickCleanup
(
$tablesToTruncate
,
TRUE
);
}
function
testActionScheduleCreate
()
{
$oldCount
=
CRM_Core_DAO
::
singleValueQuery
(
'select count(*) from civicrm_action_schedule'
);
$params
=
array
(
'title'
=>
'simpleAction'
,
'entity_value'
=>
'46'
,
);
$actionSchedule
=
$this
->
callAPISuccess
(
'action_schedule'
,
'create'
,
$params
);
$this
->
assertTrue
(
is_numeric
(
$actionSchedule
[
'id'
]),
"In line "
.
__LINE__
);
$this
->
assertTrue
(
$actionSchedule
[
'id'
]
>
0
,
"In line "
.
__LINE__
);
$newCount
=
CRM_Core_DAO
::
singleValueQuery
(
'select count(*) from civicrm_action_schedule'
);
$this
->
assertEquals
(
$oldCount
+
1
,
$newCount
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment