diff --git a/VERSIONS_HOTLINE/187495 b/VERSIONS_HOTLINE/187495 new file mode 100644 index 0000000000000000000000000000000000000000..5b4f765d178ba7841e21078113b894683644d401 --- /dev/null +++ b/VERSIONS_HOTLINE/187495 @@ -0,0 +1 @@ + - correctif #187495 : Sitotheque : correction d'une erreur dans la bibliothèque Bluga qui pouvait provoquer une erreur. \ No newline at end of file diff --git a/library/Bluga/HTTP/Request/Adapter.php b/library/Bluga/HTTP/Request/Adapter.php index 53acc726b920650e4a842c7428a4a5c07382d585..02268b0dbdedb1c336a1af17bcd83e426bbc26ae 100644 --- a/library/Bluga/HTTP/Request/Adapter.php +++ b/library/Bluga/HTTP/Request/Adapter.php @@ -1,5 +1,5 @@ <?php -abstract class Bluga_HTTP_Request_Adapter +abstract class Bluga_HTTP_Request_Adapter { /** @@ -73,13 +73,14 @@ abstract class Bluga_HTTP_Request_Adapter * @todo i don't like this approach */ public function setListeners(&$listeners) { - $this->_listeners &= $listeners; + $this->_listeners = array_merge($this->_listeners, + $listeners); } /** * Send the specified request */ - public function sendRequest() + public function sendRequest() { } @@ -88,7 +89,7 @@ abstract class Bluga_HTTP_Request_Adapter * * Base Adapter contains a non efficient baseline method */ - public function requestToFile($file) + public function requestToFile($file) { $response = $this->sendRequest(); @@ -98,7 +99,7 @@ abstract class Bluga_HTTP_Request_Adapter return $response; } - protected function parseResponseCode($line) + protected function parseResponseCode($line) { if (sscanf($line, 'HTTP/%s %s', $http_version, $returncode) != 2) { throw new Bluga_HTTP_Request_Exception('Malformed response.'); diff --git a/tests/scenarios/Templates/BlugaTest.php b/tests/scenarios/Templates/BlugaTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f2759e446ee74ef4d8a9c19490c34e741ea5ec78 --- /dev/null +++ b/tests/scenarios/Templates/BlugaTest.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright (c) 2012-2023, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class BlugaThumbnailTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + Class_AdminVar::set('BLUGA_API_KEY', '12345'); + + $this->_buildTemplateProfil(['id' => 1, + 'template' => 'CHILI']); + + $unimarc = (new Class_NoticeUnimarc_Fluent) + ->zoneWithChildren('200', ['a' => 'Droits de l\'enfance']); + + + $this->fixture(Class_Notice::class, + ['id' => 299930, + 'type_doc' => 10, + 'alpha_titre' => 'DROITS DE L\'ENFANCE', + 'type' => 1, + 'unimarc' => $unimarc->render() + ]); + + $this->fixture(Class_Sitotheque::class, + ['id' => 9644, + 'id_notice' => 299930, + 'titre' => 'Droits de l\'enfant', + 'url' => 'https://masuperurl.org' + ]); + + $this->dispatch('/recherche/viewnotice/id/299930'); + } + + + /** @test */ + public function pageShouldRenderDroitsDeLEnfance() { + $this->assertXPathContentContains('//h1', 'Droits de l\'enfance'); + } +}