Action schedule API modifications
[civicrm-core.git] / tests / phpunit / api / v3 / SystemTest.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.4 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29 /*
30 +--------------------------------------------------------------------+
31 | CiviCRM version 4.4 |
32 +--------------------------------------------------------------------+
33 | Copyright CiviCRM LLC (c) 2004-2013 |
34 +--------------------------------------------------------------------+
35 | This file is a part of CiviCRM. |
36 | |
37 | CiviCRM is free software; you can copy, modify, and distribute it |
38 | under the terms of the GNU Affero General Public License |
39 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
40 | |
41 | CiviCRM is distributed in the hope that it will be useful, but |
42 | WITHOUT ANY WARRANTY; without even the implied warranty of |
43 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
44 | See the GNU Affero General Public License for more details. |
45 | |
46 | You should have received a copy of the GNU Affero General Public |
47 | License and the CiviCRM Licensing Exception along |
48 | with this program; if not, contact CiviCRM LLC |
49 | at info[AT]civicrm[DOT]org. If you have questions about the |
50 | GNU Affero General Public License or the licensing of CiviCRM, |
51 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
52 +--------------------------------------------------------------------+
53 */
54
55 require_once 'CiviTest/CiviUnitTestCase.php';
56
57 /**
58 * Test class for System API - civicrm_system_*
59 *
60 * @package CiviCRM
61 */
62 class api_v3_SystemTest extends CiviUnitTestCase {
63
64 const TEST_CACHE_GROUP = 'SystemTest';
65 const TEST_CACHE_PATH = 'api/v3/system';
66 public $_eNoticeCompliant = TRUE;
67 /**
68 * Constructor
69 *
70 * Initialize configuration
71 */ function __construct() {
72 parent::__construct();
73 }
74
75 /**
76 * Sets up the fixture, for example, opens a network connection.
77 * This method is called before a test is executed.
78 *
79 * @access protected
80 */
81 protected function setUp() {
82 parent::setUp();
83 }
84
85 /**
86 * Tears down the fixture, for example, closes a network connection.
87 * This method is called after a test is executed.
88 *
89 * @access protected
90 */
91 protected function tearDown() {}
92
93 ///////////////// civicrm_domain_get methods
94
95 /**
96 * Test system flush
97 */
98 public function testFlush() {
99 // Note: this operation actually flushes several different caches; we don't
100 // check all of them -- just enough to make sure that the API is doing
101 // something
102
103 $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
104
105 $data = 'abc';
106 CRM_Core_BAO_Cache::setItem($data, self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH);
107
108 $this->assertEquals('abc', CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
109
110 $params = array();
111 $result = $this->callAPIAndDocument('system', 'flush', $params, __FUNCTION__, __FILE__, "Flush all system caches", 'Flush', 'flush');
112
113 $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
114 }
115 }