From 06320244553bfe510743febcd30cb1a191a42abc Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Tue, 27 Aug 2013 07:47:58 +0000 Subject: [PATCH] =?UTF-8?q?Web=20service=20Nanook:=20encode=20les=20donn?= =?UTF-8?q?=C3=A9es=20RFC=203986?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/Class/WebService/SIGB/Nanook/Service.php | 2 +- .../library/Class/WebService/SIGB/NanookTest.php | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/library/Class/WebService/SIGB/Nanook/Service.php b/library/Class/WebService/SIGB/Nanook/Service.php index c6fa0e10ad4..21cfab5332a 100644 --- a/library/Class/WebService/SIGB/Nanook/Service.php +++ b/library/Class/WebService/SIGB/Nanook/Service.php @@ -108,7 +108,7 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac public function buildQueryURL($options) { $parts = array(); foreach ($options as $key => $value) { - $value = urlencode($value); + $value = rawurlencode($value); $parts[] = $key . '/' . $value; } diff --git a/tests/library/Class/WebService/SIGB/NanookTest.php b/tests/library/Class/WebService/SIGB/NanookTest.php index f557c5609df..b8673c28739 100644 --- a/tests/library/Class/WebService/SIGB/NanookTest.php +++ b/tests/library/Class/WebService/SIGB/NanookTest.php @@ -836,7 +836,7 @@ class NanookOperationsTest extends NanookTestCase { public function reserverExemplaireShouldReturnFailureIfErrors() { $this->_mock_web_client ->whenCalled('open_url') - ->with('http://localhost:8080/afi_Nanook/ilsdi/service/HoldTitle/bibId/196895/patronId/1/pickupLocation/Site+Principal') + ->with('http://localhost:8080/afi_Nanook/ilsdi/service/HoldTitle/bibId/196895/patronId/1/pickupLocation/Site%20Principal') ->answers(NanookFixtures::xmlHoldTitleError()); $this->assertEquals(array('statut' => false, 'erreur' => 'Réservation impossible'), @@ -876,4 +876,16 @@ class NanookOperationsTest extends NanookTestCase { '196895' )); } -} \ No newline at end of file +} + + + +class NanookBuildQueryTest extends NanookTestCase { + /** @test */ + public function spaceInLoginUrlShouldBeReplacedByPercentTwenty() { + $this->assertEquals('http://localhost:8080/afi_Nanook/ilsdi/username/9999%201234', + $this->_service->buildQueryURL(['username' => '9999 1234'])); + } +} + +?> \ No newline at end of file -- GitLab