From: Tim Otten Date: Sun, 14 Sep 2014 20:28:22 +0000 (-0400) Subject: api/v3/System - Add a "get" operation to return basic system info X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=91f1889e341b19335f3b8c6de4d775853a3bd135;p=civicrm-core.git api/v3/System - Add a "get" operation to return basic system info --- diff --git a/api/v3/System.php b/api/v3/System.php index 99bec9d1ca..a75c404d70 100644 --- a/api/v3/System.php +++ b/api/v3/System.php @@ -98,4 +98,19 @@ function civicrm_api3_system_check($params) { // Spec: civicrm_api3_create_success($values = 1, $params = array(), $entity = NULL, $action = NULL) return civicrm_api3_create_success($returnValues, $params, 'System', 'Check'); -} \ No newline at end of file +} + +/** + * System.Get API + * + * @param arary $params + */ +function civicrm_api3_system_get($params) { + $returnValues = array( + array( + 'version' => CRM_Utils_System::version(), + 'uf' => CIVICRM_UF, + ), + ); + return civicrm_api3_create_success($returnValues, $params, 'System', 'get'); +} diff --git a/tests/phpunit/api/v3/SystemTest.php b/tests/phpunit/api/v3/SystemTest.php index 060d990ab2..999b223a42 100644 --- a/tests/phpunit/api/v3/SystemTest.php +++ b/tests/phpunit/api/v3/SystemTest.php @@ -112,4 +112,10 @@ class api_v3_SystemTest extends CiviUnitTestCase { $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH)); } + + 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']); + } }