From bd2105d87cb20f16a7513ff32b55bf5fa0f8f630 Mon Sep 17 00:00:00 2001 From: Ross Nelson Date: Mon, 18 Apr 2011 10:57:12 -0500 Subject: [PATCH] Added function mc_user_pref_get_pref to the API to allow read access to user preferences --- api/soap/mantisconnect.php | 20 +++++++++++++++++++ api/soap/mc_core.php | 1 + api/soap/mc_user_pref_api.php | 29 +++++++++++++++++++++++++++ tests/soap/AllTests.php | 2 + tests/soap/UserTest.php | 43 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 0 deletions(-) create mode 100644 api/soap/mc_user_pref_api.php create mode 100644 tests/soap/UserTest.php diff --git a/api/soap/mantisconnect.php b/api/soap/mantisconnect.php index efd1545..0c99df5 100644 --- a/api/soap/mantisconnect.php +++ b/api/soap/mantisconnect.php @@ -1428,6 +1428,26 @@ $l_oServer->register( 'mc_config_get_string', ); ### +### PUBLIC METHODS (defined in mc_user_pref_api.php) +### + +### mc_user_pref_get_pref +$l_oServer->register( 'mc_user_pref_get_pref', + array( + 'username' => 'xsd:string', + 'password' => 'xsd:string', + 'project_id' => 'xsd:integer', + 'pref_name' => 'xsd:string' + ), + array( + 'return' => 'xsd:string' + ), + $t_namespace, + false, false, false, + 'Get the value for the specified user preference.' +); + +### ### IMPLEMENTATION ### diff --git a/api/soap/mc_core.php b/api/soap/mc_core.php index b637c3d..4369c06 100644 --- a/api/soap/mc_core.php +++ b/api/soap/mc_core.php @@ -40,3 +40,4 @@ require_once( $t_current_dir . 'mc_project_attachment_api.php' ); require_once( $t_current_dir . 'mc_file_api.php' ); require_once( $t_current_dir . 'mc_config_api.php' ); require_once( $t_current_dir . 'mc_custom_field_api.php' ); +require_once( $t_current_dir . 'mc_user_pref_api.php' ); diff --git a/api/soap/mc_user_pref_api.php b/api/soap/mc_user_pref_api.php new file mode 100644 index 0000000..744f2cd --- /dev/null +++ b/api/soap/mc_user_pref_api.php @@ -0,0 +1,29 @@ +addTestSuite('ProjectTest'); $suite->addTestSuite('VersionTest'); $suite->addTestSuite('RelationshipTest'); + $suite->addTestSuite('UserTest'); return $suite; } diff --git a/tests/soap/UserTest.php b/tests/soap/UserTest.php new file mode 100644 index 0000000..d316109 --- /dev/null +++ b/tests/soap/UserTest.php @@ -0,0 +1,43 @@ +. + +/** + * @package Tests + * @subpackage UnitTests + * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net + * @link http://www.mantisbt.org + */ + +require_once 'SoapBase.php'; + +/** + * Test fixture for non-login user methods + */ +class UserTest extends SoapBase { + + /** + * Tests getting a user preference + */ + public function testGetPreference() { + + $language = $this->client->mc_user_pref_get_pref( $this->userName, $this->password, 0, 'language' ); + + $this->assertNotNull( $language ); + + $this->assertEquals( 'english', $language ); + + } +} -- 1.7.4.4