diff --git a/VERSIONS_WIP/155196 b/VERSIONS_WIP/155196 new file mode 100644 index 0000000000000000000000000000000000000000..caf9795d0d84d2dcec8760d13c50084ce1a8e691 --- /dev/null +++ b/VERSIONS_WIP/155196 @@ -0,0 +1 @@ + - correctif #155196 : SIGB Orphée : correction du fonctionnement avec plusieurs web services Orphée \ No newline at end of file diff --git a/library/Class/WebService/MappedSoapClient.php b/library/Class/WebService/MappedSoapClient.php index cd222356556610c6bb81d77d195080e45115a652..b04a00fe300fb0959f4ee29ba848446a46661617 100644 --- a/library/Class/WebService/MappedSoapClient.php +++ b/library/Class/WebService/MappedSoapClient.php @@ -48,25 +48,28 @@ class Class_WebService_MappedSoapClient extends SoapClient { } - protected function __getWSDLStructTypes() { - if (!$this->__getTypes()) + protected function _getWSDLStructTypes(SoapClient $client) : array { + if (!$types = $client->__getTypes()) return []; - $types = []; - foreach($this->__getTypes() as $type) { + $wsdl_types = []; + foreach($types as $type) { preg_match('/([a-z0-9_]+)\s+([a-z0-9_]+(\[\])?)(.*)?/si', $type, $matches); if ($matches[1] == 'struct') - $types[] = $matches[2]; + $wsdl_types[] = $matches[2]; } - return $types; + return $wsdl_types; } - protected function __generateClassmap() { - $classnames = $this->__getWSDLStructTypes(); + protected function _generateClassmap(SoapClient $client) : array { + $classmap = []; + $classnames = $this->_getWSDLStructTypes($client); foreach($classnames as $classname) if (class_exists($classname, false)) - $this->_classmap[$classname] = $classname; + $classmap[$classname] = $classname; + + return $classmap; } @@ -74,8 +77,8 @@ class Class_WebService_MappedSoapClient extends SoapClient { * @param $name string * @return boolean */ - public function hasFunction($name) { - foreach ($this->__getFunctions() as $function) + public function hasFunction(string $name) : bool { + foreach (($this->__getFunctions() ?? []) as $function) if (false !== strpos($function, ' ' . $name . '(')) return true; return false; @@ -91,8 +94,9 @@ class Class_WebService_MappedSoapClient extends SoapClient { } try { + $analyze_client = new SoapClient($wsdl, $options); + $options['classmap'] = $this->_generateClassmap($analyze_client); parent::__construct($wsdl, $options); - $this->__generateClassmap(); } catch (SoapFault $e) { static::logError($wsdl, $e->getMessage()); } @@ -137,4 +141,4 @@ class Class_WebService_MappedSoapClient extends SoapClient { } } -?> \ No newline at end of file +?> diff --git a/library/Class/WebService/SIGB/Orphee.php b/library/Class/WebService/SIGB/Orphee.php index d9ceca0f22007831cb1ebe2361d8e0e39547b6fe..3d0e44e912162699d7bfeb188454e217263627a3 100644 --- a/library/Class/WebService/SIGB/Orphee.php +++ b/library/Class/WebService/SIGB/Orphee.php @@ -20,31 +20,35 @@ */ class Class_WebService_SIGB_Orphee { - protected static $service; + protected static array $_services = []; - public static function getService($params){ - if (!isset(self::$service)) { - $instance = new self(); - self::$service = Class_WebService_SIGB_Orphee_Service::getService($params['url_serveur'], - isset($params['key']) ? $params['key'] : null, - $params['allow_hold_available_items'] ? $params['allow_hold_available_items'] : null); + public static function makeKey(array $params) : string { + return md5(serialize($params)); + } + + + public static function getService(array $params) : Class_WebService_SIGB_Orphee_Service { + $key = static::makeKey($params); + if (isset(static::$_services[$key])) + return static::$_services[$key]; - if (isset($params['hold_mode']) && (Class_WebService_SIGB_Orphee_Service::HOLD_MODE_ITEM === (int)$params['hold_mode'])) - self::$service->beHoldModeItem(); - } + $service = Class_WebService_SIGB_Orphee_Service::getService($params['url_serveur'], + $params['key'] ?? null, + $params['allow_hold_available_items'] ?? null); - return self::$service; + if (isset($params['hold_mode']) && (Class_WebService_SIGB_Orphee_Service::HOLD_MODE_ITEM === (int)$params['hold_mode'])) + $service->beHoldModeItem(); + + return static::$_services[$key] = $service; } - public static function setService($service) { - self::$service = $service; + public static function setService(array $params, Class_WebService_SIGB_Orphee_Service $service) : void { + static::$_services[static::makeKey($params)] = $service; } - public static function reset() { - self::$service = null; + public static function reset() : void { + static::$_services = []; } } - -?> \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Orphee/GetInfoUserCarteResponseReader.php b/library/Class/WebService/SIGB/Orphee/GetInfoUserCarteResponseReader.php index 71deb0adccd79cf5c1df03012bfcffd4eadd2110..cb305c60fe4d4528e575ec6a44f04768cb973af8 100644 --- a/library/Class/WebService/SIGB/Orphee/GetInfoUserCarteResponseReader.php +++ b/library/Class/WebService/SIGB/Orphee/GetInfoUserCarteResponseReader.php @@ -149,11 +149,17 @@ class Class_WebService_SIGB_Orphee_GetInfoUserCarteResponseReader { trim($data))))); } + public function endUser() { if (($this->_subscription_id !== null) && $this->_subscription_label) $this->_emprunteur->subscriptionAdd($this->_subscription_id, $this->_subscription_label); } + + + public function endAnx(string $data) : void { + $this->_emprunteur->setLibraryCode(trim($data)); + } } diff --git a/tests/application/modules/opac/controllers/AuthControllerLostPasswordTest.php b/tests/application/modules/opac/controllers/AuthControllerLostPasswordTest.php index 8fa7f7f2ed8353eaeeef2e4263bc78e02fbe729f..12d9ca4de04ff8dce3bc59b17e4521a4c8979faf 100644 --- a/tests/application/modules/opac/controllers/AuthControllerLostPasswordTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerLostPasswordTest.php @@ -311,7 +311,7 @@ class AuthControllerLostPasswordOrpheeOnDemandBorrowerCreationTest 'key' => '0', 'allow_hold_available_items' => '']; - $this->fixture('Class_IntBib', + $this->fixture(Class_IntBib::class, ['id' => 3, 'comm_params' => $comm_params, 'comm_sigb' => Class_IntBib::COM_ORPHEE @@ -378,7 +378,9 @@ class AuthControllerLostPasswordOrpheeOnDemandBorrowerCreationTest <lst_cat /> </user>')); - Class_WebService_SIGB_Orphee::getService($comm_params) + Class_WebService_SIGB_Orphee::getService(array_merge($comm_params, + ['id_bib' => 3, + 'type' => Class_IntBib::COM_ORPHEE])) ->setSearchClient($client) ->setSessionStrategy($this->mock() ->whenCalled('isConnected')->answers(true) @@ -500,4 +502,4 @@ class AuthControllerLostPasswordNotAllowedTest extends AbstractControllerTestCas public function shouldContainsForbidenMessage() { $this->assertXPathContentContains('//ul//li', 'La récupération de mot de passe n\'est pas possible pour ce compte.'); } -} \ No newline at end of file +} diff --git a/tests/library/Class/CommSigbTest.php b/tests/library/Class/CommSigbTest.php index 4e2cb6728936bc35dddb14a5a371bc5ca3e5d2a8..36fa41e97b77bb77f4a7379ecb628272e2e332fb 100644 --- a/tests/library/Class/CommSigbTest.php +++ b/tests/library/Class/CommSigbTest.php @@ -618,20 +618,24 @@ class CommSigbOrpheeTest extends CommSigbTestCase { public function setUp() { parent::setUp(); + $comm_params = ['url_serveur' => 'http://213.144.218.252:8080/wsOrphee/service.asmx?WSDL']; $this->bib_stomer = Class_IntBib::getLoader() ->newInstanceWithId(5) - ->setCommParams(array("url_serveur" => 'http://213.144.218.252:8080/wsOrphee/service.asmx?WSDL')) + ->setCommParams($comm_params) ->setCommSigb(8); - Class_WebService_SIGB_Orphee::setService($this->createMockForService('Orphee')); + Class_WebService_SIGB_Orphee::setService(array_merge($comm_params, + ['id_bib' => 5, + 'type' => Class_IntBib::COM_ORPHEE]), + $this->createMockForService('Orphee')); } /** @test */ public function getModeCommShouldReturnAnArrayWithCommParams() { - $this->assertEquals(array("url_serveur" => 'http://213.144.218.252:8080/wsOrphee/service.asmx?WSDL', - "type" => Class_IntBib::COM_ORPHEE, - 'id_bib' => 5), + $this->assertEquals(['url_serveur' => 'http://213.144.218.252:8080/wsOrphee/service.asmx?WSDL', + 'type' => Class_IntBib::COM_ORPHEE, + 'id_bib' => 5], $this->bib_stomer->getModeComm(5)); } } diff --git a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php index 90a08128f3d0cc16477f6276b78fb722bb3d1417..8378060f86094496e3175011411d460c0a3de603 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php +++ b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php @@ -132,23 +132,28 @@ abstract class OrpheeServiceTestCase extends ModelTestCase { $this->_orphee_allow_hold_avail = Class_WebService_SIGB_Orphee_Service::getService('tests/fixtures/orphee.wsdl', null, $allow_hold_available_items); $this->_orphee_allow_hold_avail->setSearchClient($this->_search_client); $this->_orphee_allow_hold_avail->isConnected(); - $this->_orphee = new Class_WebService_SIGB_Orphee_ServiceForTesting($this->_search_client); - Class_WebService_SIGB_Orphee::setService($this->_orphee); - $this->_henry_dupont = $this->fixture('Class_Users', + $comm_params = ['url_serveur' => 'tests/fixtures/orphee.wsdl', + 'allow_hold_available_items' => true]; + $this->_henry_dupont = $this->fixture(Class_Users::class, ['id' => 2, 'login' => '10900000753', 'idabon' => '100753', 'password' => 'secret', - 'int_bib' => $this->fixture('Class_IntBib', + 'int_bib' => $this->fixture(Class_IntBib::class, ['id' => 34, 'comm_sigb' => Class_IntBib::COM_ORPHEE, - 'comm_params' => ['url_serveur' => 'tests/fixtures/orphee.wsdl', - 'allow_hold_available_items' => true]]), + 'comm_params' => $comm_params]), 'bib' => $this->fixture('Class_Bib', ['id' => 34])]); $this->_henry_dupont->beAbonneSIGB()->assertSave(); + + + Class_WebService_SIGB_Orphee::setService(array_merge($comm_params, + ['id_bib' => 34, + 'type' => Class_IntBib::COM_ORPHEE]), + $this->_orphee); } @@ -947,42 +952,45 @@ class OrpheeServiceGetInfoUserCarteHenryDupontTest extends OrpheeServiceTestCase public function setUp() { parent::setUp(); - $this->fixture('Class_CodifAnnexe', ['id' => 3, - 'id_origine' => 'A3', - 'libelle' => 'Annecy Bonlieu', - 'id_bib' => 3]); + $this->fixture(Class_CodifAnnexe::class, + ['id' => 3, + 'id_origine' => 'A3', + 'libelle' => 'Annecy Bonlieu', + 'id_bib' => 3]); - $this->fixture('Class_CodifAnnexe', ['id' => 4, - 'id_origine' => 'R', - 'libelle' => 'Romains']); + $this->fixture(Class_CodifAnnexe::class, + ['id' => 4, + 'id_origine' => 'R', + 'libelle' => 'Romains']); - $this->fixture('Class_Bib', ['id' => 3, - 'libelle' => 'Bonlieu']); + $this->fixture(Class_Bib::class, + ['id' => 3, + 'libelle' => 'Bonlieu']); $ex_potter = $this->fixture( - 'Class_Exemplaire', + Class_Exemplaire::class, ['id' => 23, 'code_barres' => '123456', 'annexe' => 'A3', 'id_bib' => 3, - 'notice' => $this->fixture('Class_Notice', + 'notice' => $this->fixture(Class_Notice::class, ['id' => 5, 'titre_principal' => 'Harry Potter', 'auteur_principal' => 'Rowling'])]); $ex_chemin = $this->fixture( - 'Class_Exemplaire', + Class_Exemplaire::class, ['id' => 32, 'code_barres' => '98374', 'id_bib' => 3, - 'notice' => $this->fixture('Class_Notice', + 'notice' => $this->fixture(Class_Notice::class, ['id' => '974898302', 'titre_principal' => 'Le Chemin', 'auteur_principal' => 'Kyo'])]); $ex_singe_bleu = $this->fixture( - 'Class_Exemplaire', + Class_Exemplaire::class, ['id' => 33, 'code_barres' => '678', 'id_bib' => 3]); @@ -1030,6 +1038,12 @@ class OrpheeServiceGetInfoUserCarteHenryDupontTest extends OrpheeServiceTestCase } + /** @test */ + public function emprunteurLibraryCodeShouldBeOne() { + $this->assertEquals(1, $this->emprunteur->getLibraryCode()); + } + + /** @test */ public function firstWaitingToBePulledHoldShouldHaveLocationId3ForBonlieu() { $this->assertEquals(3, $this->emprunteur->getHoldsWaitingToBePulled()[0]->getLocationId()); @@ -1802,4 +1816,4 @@ class OrpheeAuthenticateThroughSigbTest extends OrpheeServiceTestCase { ZendAfi_Auth::getInstance()->authenticateLoginPassword('10900000753', 'oups'); $this->assertEmpty(Class_Users::getIdentity()); } -} \ No newline at end of file +} diff --git a/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php b/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php index a6042491c7d2a3d75b3ecbe254d749b2ca462b12..7b3f39987238ec1af45a05d59f7a6c2a217ddc6a 100644 --- a/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php +++ b/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php @@ -82,37 +82,62 @@ abstract class AuthCommSigbWithWebServicesAndAbonneZorkTestCase extends AuthComm public function setUp() { parent::setUp(); - $comm_params = ['url_serveur' => 'http://localhost:8080/afi_Nanook/ilsdi/', - 'id_bib' => 1, - 'type' => Class_IntBib::COM_NANOOK]; + $nanook_comm_params = ['url_serveur' => 'http://localhost:8080/afi_Nanook/ilsdi/', + 'id_bib' => 1, + 'type' => Class_IntBib::COM_NANOOK]; - $this->fixture('Class_IntBib', ['id' => 1, - 'comm_sigb' => Class_IntBib::COM_NANOOK, - 'comm_params' => $comm_params]); + $this->fixture(Class_IntBib::class, + ['id' => 1, + 'comm_sigb' => Class_IntBib::COM_NANOOK, + 'comm_params' => $nanook_comm_params]); - $this->fixture('Class_IntBib', ['id' => 95, - 'comm_sigb' => Class_IntBib::COM_ORPHEE]); - $this->fixture('Class_IntBib', ['id' => 74, - 'comm_sigb' => Class_IntBib::COM_OPSYS, - 'nom_court' => 'TestingOpsys']); + $orphee_comm_params = ['url_serveur' => 'http://localhost:8080/orphee.wsdl', + 'id_bib' => 95, + 'type' => Class_IntBib::COM_ORPHEE]; - $this->fixture('Class_IntMajAuto', ['id' => 100, - 'id_bib' => 74, - 'profil' => 57]); + $this->fixture(Class_IntBib::class, + ['id' => 95, + 'comm_sigb' => Class_IntBib::COM_ORPHEE, + 'comm_params' => $orphee_comm_params]); - $this->fixture('Class_IntProfilDonnees', + $this->fixture(Class_IntBib::class, + ['id' => 74, + 'comm_sigb' => Class_IntBib::COM_OPSYS, + 'nom_court' => 'TestingOpsys']); + + $this->fixture(Class_IntMajAuto::class, + ['id' => 100, + 'id_bib' => 74, + 'profil' => 57]); + + $this->fixture(Class_IntProfilDonnees::class, ['id' => 57, 'libelle' => 'Some patrons', 'type_fichier' => Class_IntProfilDonnees::FT_PATRONS]); - Class_WebService_SIGB_Nanook::setService($comm_params, + Class_WebService_SIGB_Nanook::setService($nanook_comm_params, $this->nanook = $this->mock() ->whenCalled('providesAuthentication') ->answers(true)); - Class_WebService_SIGB_Orphee::setService($this->orphee = $this->mock() - ->whenCalled('providesAuthentication') - ->answers(false)); + + Class_WebService_SIGB_Orphee::setService($orphee_comm_params, + new class('http://orphee.wsdl', 'key', false, []) + extends Class_WebService_SIGB_Orphee_Service { + public function providesAuthentication() { + return false; + } + public function getEmprunteur($user) { + return Class_WebService_SIGB_Emprunteur::nullInstance(); + } + public function isConnected() { + return true; + } + public function disconnect() { + return $this; + } + }); + Class_WebService_SIGB_Opsys::setService($this->opsys = $this->mock() ->whenCalled('providesAuthentication') ->answers(true)); @@ -121,10 +146,6 @@ abstract class AuthCommSigbWithWebServicesAndAbonneZorkTestCase extends AuthComm ->whenCalled('getEmprunteur') ->answers(null); - $this->orphee - ->whenCalled('getEmprunteur') - ->answers(Class_WebService_SIGB_Emprunteur::nullInstance()); - $annecy_library = $this->fixture('Class_Bib', ['id' => 43, 'libelle' => 'annecy']); @@ -153,7 +174,7 @@ abstract class AuthCommSigbWithWebServicesAndAbonneZorkTestCase extends AuthComm public function tearDown() { Class_WebService_SIGB_Nanook::reset(); - Class_WebService_SIGB_Orphee::setService(null); + Class_WebService_SIGB_Orphee::reset(); Class_WebService_SIGB_Opsys::setService(null); parent::tearDown(); @@ -573,4 +594,4 @@ class AuthCommSigbWithWebServicesAndAbonneZorkAndMinimalResponseTest public function prenomShouldBecomeZinn() { $this->assertEquals('Zinn', $this->_zork->getPrenom()); } -} \ No newline at end of file +} diff --git a/tests/scenarios/PnbDilicom/PnbDilicomDisplayTest.php b/tests/scenarios/PnbDilicom/PnbDilicomDisplayTest.php index 3cb95196cb0ffb15c667c1b2f9c805dc70a28933..686b67a3ae3a99a43bddc7005bec40302b0f7bc5 100644 --- a/tests/scenarios/PnbDilicom/PnbDilicomDisplayTest.php +++ b/tests/scenarios/PnbDilicom/PnbDilicomDisplayTest.php @@ -25,29 +25,32 @@ class PnbDilicomDisplayBibNumeriqueControllerBlockedUserTest extends AbstractCon protected $_http, $_book, - $_time_source, - $_storm_default_to_volatile = true; + $_time_source; public function setUp() { parent::setUp(); $_SERVER['HTTP_REFERER'] = '/viewnotice/id/3'; - $this->fixture('Class_Bib', ['id' => 1, 'gln' => '2345889']); + $this->fixture(Class_Bib::class, + ['id' => 1, + 'gln' => '2345889']); Class_AdminVar::set('DILICOM_PNB_MAX_LOAN_DURATION', 0); - Class_WebService_BibNumerique_Dilicom_Hub::setPhpCommand($this->mock()->whenCalled('rand')->answers('1930') + Class_WebService_BibNumerique_Dilicom_Hub::setPhpCommand($this->mock() + ->whenCalled('rand')->answers('1930') ->whenCalled('hash')->answers('10')); - $group = $this->fixture('Class_UserGroup', ['id' => '20', - 'libelle' => 'Dilicom', - 'group_type' => Class_UserGroup::TYPE_DYNAMIC, - 'filters' => json_encode([ - 'search_role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB, - 'search_valid_subscription' => 1]), - 'rights' => [Class_UserGroup::RIGHT_ACCES_PNB_DILICOM]]); + $group = $this->fixture(Class_UserGroup::class, + ['id' => '20', + 'libelle' => 'Dilicom', + 'group_type' => Class_UserGroup::TYPE_DYNAMIC, + 'filters' => json_encode([ + 'search_role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB, + 'search_valid_subscription' => 1]), + 'rights' => [Class_UserGroup::RIGHT_ACCES_PNB_DILICOM]]); - $logged_user = $this->fixture('Class_Users', + $logged_user = $this->fixture(Class_Users::class, ['id' => 6, 'nom'=>'Pito', 'login'=>'Chat', @@ -56,16 +59,25 @@ class PnbDilicomDisplayBibNumeriqueControllerBlockedUserTest extends AbstractCon 'int_bib' => $this->fixture('Class_IntBib', ['id' => 1, 'comm_sigb' => Class_IntBib::COM_ORPHEE, - 'comm_params' => ['url_serveur' => 'tests/fixtures/orphee.wsdl', - 'allow_hold_available_items' => true]]), + 'comm_params' => $comm_params = ['url_serveur' => 'tests/fixtures/orphee.wsdl', + 'allow_hold_available_items' => true]]), 'idabon' => '12345', ]); - Class_WebService_SIGB_Orphee::setService($this->mock() - ->whenCalled('isConnected')->answers(true) - ->whenCalled('getEmprunteur') - ->answers(Class_WebService_SIGB_Emprunteur::nullInstance()->beBlocked()) - ); + Class_WebService_SIGB_Orphee::setService($comm_params, + new class('http://orphee.wsdl', 'key', false, []) + extends Class_WebService_SIGB_Orphee_Service { + public function isConnected() { + return true; + } + public function getEmprunteur($user) { + return Class_WebService_SIGB_Emprunteur::nullInstance() + ->beBlocked(); + } + public function disconnect() { + return $this; + } + }); $logged_user->beAbonneSIGB()->assertSave(); ZendAfi_Auth::getInstance()->logUser($logged_user); @@ -89,7 +101,7 @@ class PnbDilicomDisplayBibNumeriqueControllerBlockedUserTest extends AbstractCon Class_Album_UsageConstraint::setTimeSource(null); Class_Loan_Pnb::setTimeSource(null); RessourcesNumeriquesFixtures::deactivateDilicom(); - Class_WebService_SIGB_Orphee::setService(null); + Class_WebService_SIGB_Orphee::reset(); parent::tearDown(); } diff --git a/tests/scenarios/PnbDilicom/PnbDilicomViewHelperTest.php b/tests/scenarios/PnbDilicom/PnbDilicomViewHelperTest.php index 2ba9529bb972aa0cf5bfc47276c450541f7489e3..39d08bc697fdfab775a77e1e17981db4296591b1 100644 --- a/tests/scenarios/PnbDilicom/PnbDilicomViewHelperTest.php +++ b/tests/scenarios/PnbDilicom/PnbDilicomViewHelperTest.php @@ -235,11 +235,12 @@ class PnbDilicomViewHelperRenderAlbumLoggedButBlockedTest public function setUp() { parent::setUp(); - $this->fixture('Class_Bib', ['id' => 1, - 'libelle' => 'Annecy', - 'gln' => '333']); + $this->fixture(Class_Bib::class, + ['id' => 1, + 'libelle' => 'Annecy', + 'gln' => '333']); - $group = $this->fixture('Class_UserGroup', + $group = $this->fixture(Class_UserGroup::class, ['id' => '20', 'libelle' => 'Dilicom', 'group_type' => Class_UserGroup::TYPE_DYNAMIC, @@ -250,32 +251,42 @@ class PnbDilicomViewHelperRenderAlbumLoggedButBlockedTest 'rights' => [Class_UserGroup::RIGHT_ACCES_PNB_DILICOM]]); $this->logged_user = $this - ->fixture('Class_Users', + ->fixture(Class_Users::class, ['id' => 6, 'nom'=>'Pito', 'login'=>'Chat', 'password'=>'123456', 'id_site' => 1, - 'int_bib' => $this->fixture('Class_IntBib', + 'int_bib' => $this->fixture(Class_IntBib::class, ['id' => 1, 'comm_sigb' => Class_IntBib::COM_ORPHEE, - 'comm_params' => ['url_serveur' => 'tests/fixtures/orphee.wsdl', - 'allow_hold_available_items' => true]]), + 'comm_params' => $comm_params = ['url_serveur' => 'tests/fixtures/orphee.wsdl', + 'allow_hold_available_items' => true]]), 'idabon' => '12345', ]); - Class_WebService_SIGB_Orphee::setService($this->mock() - ->whenCalled('isConnected')->answers(true) - ->whenCalled('getEmprunteur') - ->answers(Class_WebService_SIGB_Emprunteur::nullInstance()->beBlocked()) - ); + Class_WebService_SIGB_Orphee::setService($comm_params, + new class('http://orphee.wsdl', 'key', false, []) + extends Class_WebService_SIGB_Orphee_Service { + public function isConnected() { + return true; + } + public function getEmprunteur($user) { + return Class_WebService_SIGB_Emprunteur::nullInstance() + ->beBlocked(); + } + public function disconnect() { + return $this; + } + }); $this->logged_user->beAbonneSIGB()->assertSave(); ZendAfi_Auth::getInstance()->logUser($this->logged_user); - $this->fixture('Class_Loan_Pnb', ['id' => 1, - 'record_origin_id' => 'Dilicom-88817216', - 'user_id' => '6']); + $this->fixture(Class_Loan_Pnb::class, + ['id' => 1, + 'record_origin_id' => 'Dilicom-88817216', + 'user_id' => '6']); $this->_html = $this->_helper->renderAlbum($this->book); @@ -284,7 +295,7 @@ class PnbDilicomViewHelperRenderAlbumLoggedButBlockedTest public function tearDown() { unset($_SERVER['HTTPS']); - Class_WebService_SIGB_Orphee::setService(null); + Class_WebService_SIGB_Orphee::reset(); parent::tearDown(); }