--- /dev/null
+<?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
--- /dev/null
+<?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);
+
+ }
+
+
+}