From ffb259cbbcebfb806ac6d865a0dcdcdb3ffa7b9d Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Fri, 7 Jun 2013 13:00:00 +0000 Subject: [PATCH] =?UTF-8?q?SIGB=20Koha:=20authentification=20par=20web=20s?= =?UTF-8?q?ervices=20force=20l'utilisation=20du=20num=C3=A9ro=20de=20carte?= =?UTF-8?q?=20au=20lieu=20du=20login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Class/WebService/SIGB/Koha/Service.php | 2 +- .../Class/WebService/SIGB/KohaFixtures.php | 6 +-- .../Class/WebService/SIGB/KohaTest.php | 54 ++++++++----------- 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/library/Class/WebService/SIGB/Koha/Service.php b/library/Class/WebService/SIGB/Koha/Service.php index e7d5d651152..8a72fa66c4e 100644 --- a/library/Class/WebService/SIGB/Koha/Service.php +++ b/library/Class/WebService/SIGB/Koha/Service.php @@ -41,7 +41,7 @@ class Class_WebService_SIGB_Koha_Service extends Class_WebService_SIGB_AbstractR */ protected function _authenticate($user) { $xml_auth = $this->httpGet(array('service' => 'LookupPatron', - 'id' => ($user->hasIdSigb() ? $user->getIdSigb() : $user->getLogin()), + 'id' => ($user->hasIdSigb() ? $user->getIdSigb() : $user->getIdabon()), 'id_type' => 'cardnumber')); return $this->_getTagData($xml_auth, 'id'); diff --git a/tests/library/Class/WebService/SIGB/KohaFixtures.php b/tests/library/Class/WebService/SIGB/KohaFixtures.php index 414a6665266..80f9bc09141 100644 --- a/tests/library/Class/WebService/SIGB/KohaFixtures.php +++ b/tests/library/Class/WebService/SIGB/KohaFixtures.php @@ -523,7 +523,7 @@ class KohaFixtures { } - public static function xmlLookupPatronLaurent() { + public static function xmlLookupPatronLaure() { return '<?xml version="1.0" encoding="ISO-8859-1" ?> <LookupPatron> <id>572</id> @@ -531,7 +531,7 @@ class KohaFixtures { } - public static function xmlGetPatronInfoLaurent() { + public static function xmlGetPatronInfoLaure() { return '<?xml version="1.0" encoding="UTF-8" ?> <GetPatronInfo> <category_type>A</category_type> @@ -621,7 +621,7 @@ class KohaFixtures { <dateofbirth>1978-02-17</dateofbirth> <B_address2></B_address2> <branchname>Bibliothèque Départementale de la Meuse</branchname> - <surname>llaffont</surname> + <surname>lafond</surname> <gonenoaddresscomment></gonenoaddresscomment> <cardnumber>10002000</cardnumber> <opacnote></opacnote> diff --git a/tests/library/Class/WebService/SIGB/KohaTest.php b/tests/library/Class/WebService/SIGB/KohaTest.php index dd366983779..9c8c8a40796 100644 --- a/tests/library/Class/WebService/SIGB/KohaTest.php +++ b/tests/library/Class/WebService/SIGB/KohaTest.php @@ -279,27 +279,28 @@ class KohaGetEmprunteurErrorTest extends KohaTestCase { -class KohaGetEmprunteurLaurentLaffontTest extends KohaTestCase { +class KohaGetEmprunteurLaureAfondTest extends KohaTestCase { public function setUp() { parent::setUp(); $this->mock_web_client ->expects($this->at(0)) ->method('open_url') - ->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=llaffont&id_type=cardnumber') - ->will($this->returnValue(KohaFixtures::xmlLookupPatronLaurent())); + ->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=012345&id_type=cardnumber') + ->will($this->returnValue(KohaFixtures::xmlLookupPatronLaure())); $this->mock_web_client ->expects($this->at(1)) ->method('open_url') ->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=GetPatronInfo&patron_id=572&show_contact=0&show_loans=1&show_holds=1') - ->will($this->returnValue(KohaFixtures::xmlGetPatronInfoLaurent())); + ->will($this->returnValue(KohaFixtures::xmlGetPatronInfoLaure())); $this->laurent = $this->service->getEmprunteur( Class_Users::getLoader()->newInstance() - ->setLogin('llaffont') - ->setPassword('afi') + ->setLogin('lafond') + ->setPassword('afi') + ->setIdabon('012345') ); } @@ -347,7 +348,7 @@ class KohaGetEmprunteurLaurentLaffontTest extends KohaTestCase { /** @test */ - function prenomShouldBeLaurent() { + function prenomShouldBeLaure() { $this->assertEquals('laurent', $this->laurent->getPrenom()); } @@ -456,11 +457,16 @@ class KohaOperationsTest extends KohaTestCase { public function setUp() { parent::setUp(); + $this->_lafond = Class_Users::getLoader()->newInstance() + ->setLogin('lafond') + ->setPassword('afi') + ->setIdabon('012345'); + $this->mock_web_client ->expects($this->at(0)) ->method('open_url') - ->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=llaffont&id_type=cardnumber') - ->will($this->returnValue(KohaFixtures::xmlLookupPatronLaurent())); + ->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=012345&id_type=cardnumber') + ->will($this->returnValue(KohaFixtures::xmlLookupPatronLaure())); $this->_exemplaire_mireille_abeille = Class_Exemplaire::getLoader() @@ -479,10 +485,7 @@ class KohaOperationsTest extends KohaTestCase { $this->assertEquals(array('statut' => true,'erreur' => ''), - $this->service->supprimerReservation( - Class_Users::getLoader()->newInstance() - ->setLogin('llaffont') - ->setPassword('afi'), '24426')); + $this->service->supprimerReservation($this->_lafond, '24426')); } @@ -496,10 +499,7 @@ class KohaOperationsTest extends KohaTestCase { $this->assertEquals(array('statut' => false,'erreur' => 'NotCanceled'), - $this->service->supprimerReservation( - Class_Users::getLoader()->newInstance() - ->setLogin('llaffont') - ->setPassword('afi'), '24426')); + $this->service->supprimerReservation($this->_lafond, '24426')); } @@ -519,10 +519,7 @@ class KohaOperationsTest extends KohaTestCase { $this->assertEquals(array('statut' => false, 'erreur' => 'Prolongation impossible'), - $this->service->prolongerPret( - Class_Users::getLoader()->newInstance() - ->setLogin('llaffont') - ->setPassword('afi'), '24426')); + $this->service->prolongerPret($this->_lafond, '24426')); } @@ -541,10 +538,7 @@ class KohaOperationsTest extends KohaTestCase { $this->assertEquals(array('statut' => true, 'erreur' => ''), - $this->service->prolongerPret( - Class_Users::getLoader()->newInstance() - ->setLogin('llaffont') - ->setPassword('afi'), '24426')); + $this->service->prolongerPret($this->_lafond, '24426')); } @@ -561,10 +555,7 @@ class KohaOperationsTest extends KohaTestCase { </HoldTitle>')); $this->assertEquals(array('statut' => true, 'erreur' => ''), - $this->service->reserverExemplaire( - Class_Users::getLoader()->newInstance() - ->setLogin('llaffont') - ->setPassword('afi'), $this->_exemplaire_mireille_abeille, '')); + $this->service->reserverExemplaire($this->_lafond, $this->_exemplaire_mireille_abeille, '')); } @@ -580,10 +571,7 @@ class KohaOperationsTest extends KohaTestCase { </HoldTitle>')); $this->assertEquals(array('statut' => false, 'erreur' => 'Réservation impossible'), - $this->service->reserverExemplaire( - Class_Users::getLoader()->newInstance() - ->setLogin('llaffont') - ->setPassword('afi'), $this->_exemplaire_mireille_abeille, '')); + $this->service->reserverExemplaire($this->_lafond, $this->_exemplaire_mireille_abeille, '')); } } -- GitLab