From: vivekarora Date: Tue, 12 Nov 2013 13:56:20 +0000 (+0530) Subject: Code review for schedule reminders X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e790a8cbcfc6938f55cc3ae8b6a55950984f572e;p=civicrm-core.git Code review for schedule reminders --- diff --git a/api/v3/ActionSchedule.php b/api/v3/ActionSchedule.php new file mode 100644 index 0000000000..37ce6a30a5 --- /dev/null +++ b/api/v3/ActionSchedule.php @@ -0,0 +1,90 @@ +. + */ + +/** + * 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); + + } + + +}