useTransaction(TRUE); } ///////////////// civicrm_domain_get methods /** * Test system flush */ public function testFlush() { // Note: this operation actually flushes several different caches; we don't // check all of them -- just enough to make sure that the API is doing // something $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH)); $data = 'abc'; CRM_Core_BAO_Cache::setItem($data, self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH); $this->assertEquals('abc', CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH)); $params = array(); $result = $this->callAPIAndDocument('system', 'flush', $params, __FUNCTION__, __FILE__, "Flush all system caches", 'Flush', 'flush'); $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH)); } /** * Test system log function */ public function testSystemLog() { $this->callAPISuccess('system', 'log', array('level' => 'info', 'message' => 'We wish you a merry Christmas')); $result = $this->callAPISuccess('SystemLog', 'getsingle', array( 'sequential' => 1, 'message' => array('LIKE' => '%Chris%'), )); $this->assertEquals($result['message'], 'We wish you a merry Christmas'); $this->assertEquals($result['level'], 'info'); } /** * Test system log function */ public function testSystemLogNoLevel() { $this->callAPISuccess('system', 'log', array('message' => 'We wish you a merry Christmas', 'level' => 'alert')); $result = $this->callAPISuccess('SystemLog', 'getsingle', array( 'sequential' => 1, 'message' => array('LIKE' => '%Chris%'), )); $this->assertEquals($result['message'], 'We wish you a merry Christmas'); $this->assertEquals($result['level'], 'alert'); } public function testSystemGet() { $result = $this->callAPISuccess('system', 'get', array()); $this->assertRegExp('/^[0-9]+\.[0-9]+\.[0-9a-z\-]+$/', $result['values'][0]['version']); $this->assertEquals('UnitTests', $result['values'][0]['uf']); } }