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