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

L'opac peut fonctionner avec plusieurs webservices Koha en parallèle

parent b427bd79
Branches
Tags
No related merge requests found
......@@ -20,26 +20,31 @@
*/
class Class_WebService_SIGB_Koha {
protected static $service;
protected static $services = [];
public static function makeKey($params) {
return md5(serialize($params));
}
public static function getService($params){
if (!isset(self::$service)) {
$instance = new self();
$key = static::makeKey($params);
if (!isset(static::$services[$key])) {
$instance = new static();
$params = array_merge(['Interdire_reservation_doc_dispo' => 0],$params);
self::$service = Class_WebService_SIGB_Koha_Service::getService($params['url_serveur'],$params['Interdire_reservation_doc_dispo']==='1');
static::$services[$key] = Class_WebService_SIGB_Koha_Service::getService($params['url_serveur'],$params['Interdire_reservation_doc_dispo']==='1');
}
return self::$service;
return static::$services[$key];
}
public static function setService($service) {
self::$service = $service;
public static function setService($params, $service) {
static::$services[static::makeKey($params)] = $service;
}
public static function reset() {
self::$service = null;
static::$services = [];
}
}
......
......@@ -193,7 +193,7 @@ abstract class CommSigbTestCase extends Storm_Test_ModelTestCase {
'ABC')
->will($this->returnValue(array('statut' => 1,
'erreur' => '')));
xdebug_break();
$this->assertEquals(array('statut' => 1,
'erreur' => ''),
$this->comm_sigb->reserverExemplaire(5, '123', 'ABC'));
......@@ -346,14 +346,18 @@ class CommSigbMoulinsVSmartTest extends CommSigbTestCase {
class CommSigbMeuseKohaTest extends CommSigbTestCase {
public function setUp() {
parent::setUp();
$params = ['url_serveur' => 'http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl'];
$this->bib_koha = Class_IntBib::getLoader()
->newInstanceWithId(5)
->setCommParams(array("url_serveur" => 'http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl'))
->setCommParams($params)
->setCommSigb(5);
Class_WebService_SIGB_Koha::setService($this->createMockForService('Koha'));
Class_WebService_SIGB_Koha::setService(array_merge($params,
['id_bib' => 5,
'type' => Class_IntBib::COM_KOHA]),
$this->createMockForService('Koha'));
}
......
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