Skip to content
Snippets Groups Projects
Commit 6d333d1e authored by llaffont's avatar llaffont
Browse files

Dynix: prise en compte du client id dans les requêtes REST pour l'authentification WS

parent 44a3c973
No related merge requests found
......@@ -18,5 +18,10 @@
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_WebService_SIGB_Dynix extends Class_WebService_SIGB_Abstract {}
class Class_WebService_SIGB_Dynix extends Class_WebService_SIGB_Abstract {
public static function getService($params){
return parent::getService($params)->setClientId($params['client_id']);
}
}
?>
\ No newline at end of file
......@@ -19,6 +19,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Webservice_SIGB_Dynix_Service extends Class_WebService_SIGB_AbstractRESTService {
protected $_client_id;
public function setClientId($client_id) {
$this->_client_id = $client_id;
return $this;
}
public function getEmprunteur($user){}
......@@ -33,7 +41,7 @@ class Class_Webservice_SIGB_Dynix_Service extends Class_WebService_SIGB_Abstract
public function getNotice($id){
return $this->httpGetNotice(['service' => 'lookupTitleInfo',
'clientID' => 'myid',
'clientID' => $this->_client_id,
'titleID' => $id,
'includeItemInfo' => 'true',
'includeAvailabilityInfo' => 'true'],
......
......@@ -55,8 +55,10 @@ abstract class DynixTestCase extends Storm_Test_ModelTestCase {
$this->_mock_web_client = Storm_Test_ObjectWrapper::mock();
$this->_service = Class_WebService_SIGB_Dynix_Service::newInstance()
->setServerRoot('http://www.infocom94.fr:8080/capcvm/rest/standard')
$this->_service = Class_WebService_SIGB_Dynix
::getService(['url_serveur' => 'http://www.infocom94.fr:8080/capcvm/rest/standard',
'client_id' => 'SymWS'])
->setWebClient($this->_mock_web_client);
}
}
......@@ -72,7 +74,7 @@ class DynixGetNoticeLeCombatOrdinaire extends DynixTestCase {
$this->_mock_web_client
->whenCalled('open_url')
->with('http://www.infocom94.fr:8080/capcvm/rest/standard/lookupTitleInfo?clientID=myid&titleID=233823&includeItemInfo=true&includeAvailabilityInfo=true')
->with('http://www.infocom94.fr:8080/capcvm/rest/standard/lookupTitleInfo?clientID=SymWS&titleID=233823&includeItemInfo=true&includeAvailabilityInfo=true')
->answers(DynixFixtures::xmlLookupTitleInfoLeCombatOrdinaire())
->beStrict();
......@@ -164,9 +166,11 @@ class DynixGetNoticeHarryPotter extends DynixTestCase {
public function setUp() {
parent::setUp();
$this->_service->setClientId('RealWS');
$this->_mock_web_client
->whenCalled('open_url')
->with('http://www.infocom94.fr:8080/capcvm/rest/standard/lookupTitleInfo?clientID=myid&titleID=353917&includeItemInfo=true&includeAvailabilityInfo=true')
->with('http://www.infocom94.fr:8080/capcvm/rest/standard/lookupTitleInfo?clientID=RealWS&titleID=353917&includeItemInfo=true&includeAvailabilityInfo=true')
->answers(DynixFixtures::xmlLookupTitleInfoHarryPotter())
->beStrict();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment