--- system_service/system_service.inc 7 Mar 2009 22:35:04 -0000 1.1.2.5 +++ system_service/system_service.inc 1 Nov 2009 19:15:31 -0000 @@ -1,5 +1,6 @@ info['version']; - } - } + $list = module_list(); - return ""; + // Returning module version if module is enabled. + $version = ($list[$module]) ? t('Unkwown version') : ''; + return $version; } /** --- system_service/system_service.info 10 Jan 2008 00:35:53 -0000 1.5 +++ system_service/system_service.info 1 Nov 2009 11:27:59 -0000 @@ -3,4 +3,7 @@ description = Provides system services. package = Services - services dependencies[] = services -core = 6.x \ No newline at end of file +files[] = system_service.inc +files[] = system_service.module +files[] = system_service.test +core = 7.x \ No newline at end of file --- system_service/system_service.module 15 Oct 2009 03:54:05 -0000 1.3.2.20.2.1 +++ system_service/system_service.module 2 Nov 2009 00:18:44 -0000 @@ -1,5 +1,6 @@ array( + 'title' => t('Send mail from remote'), + 'description' => t('Send an email using services.'), + ), + 'get variable from remote' => array( + 'title' => t('Get variable from remote'), + 'description' => t('Get the value of a system variable using services.'), + ), + 'set variable from remote' => array( + 'title' => t('Set variable from remote'), + 'description' => t('Set the value of a system variable using services.'), + ), + 'check module exists from remote' => array( + 'title' => t('Check module exists from remote'), + 'description' => t('Check if a module is enabled in the server using services.'), + ), + 'clear cache from remote' => array( + 'title' => t('Clear cache from remote'), + 'description' => t('Clearh all the cache systems in the server using services.'), + ), + ); } /** - * Implementation of hook_service(). + * Implements hook_service(). */ function system_service_service() { return array( --- system_service/system_service.test +++ system_service/system_service.test @@ -0,0 +1,79 @@ + 'System services', + 'description' => 'Test system services implementation.', + 'group' => 'Services - Services', + ); + } + + /* + * Enable the module and configure the basics for the test. + */ + function setUp() { + parent::setUp('services', 'system_service'); + module_load_include('inc', 'system_service'); + } + + /* + * Test user_service_connect implementation. + */ + function testSystemServiceConnect() { + global $user; + + $result = system_service_connect(); + $this->assertEqual($result->sessid, session_id(), t('system_service_connect session successfully validated.')); + $this->assertEqual($result->user->uid, $user->uid, t('system_service_connect user successfully validated.')); + } + + /* + * Test user_service_getvariable implementation. + */ + function testSystemServiceGetVariable() { + $name = $this->randomName(); + $value = $this->randomName(); + + variable_set($name, $value); + $this->assertEqual($value, system_service_getvariable($name, NULL), t('system_service_getvariable successfully verified.')); + + variable_del($name); + } + + /* + * Test user_service_setvariable implementation. + */ + function testSystemServiceSetVariable() { + $name = $this->randomName(); + $value = $this->randomName(); + + system_service_setvariable($name, $value); + $this->assertEqual($value, variable_get($name, NULL), t('system_service_setvariable successfully verified.')); + + variable_del($name); + } + + /* + * Test user_service_module_exists implementation. + */ + function testSystemServiceModuleExists() { + + // Try a valid module + $version = system_service_module_exists('system_service'); + $this->assertTrue(!empty($version), t('system_service_module_exists valid module successfully verified.')); + + // Try an invalid module + $version = system_service_module_exists($this->randomName()); + $this->assertTrue(empty($version), t('system_service_module_exists invalid module successfully verified.')); + } + +}