diff --git a/VERSIONS_HOTLINE/74837 b/VERSIONS_HOTLINE/74837 new file mode 100644 index 0000000000000000000000000000000000000000..6cff7d2e26a21f5a6c6af0bc91edd73c608ee6ee --- /dev/null +++ b/VERSIONS_HOTLINE/74837 @@ -0,0 +1,2 @@ + - ticket #74837 : correction de l'affichage du plan d'accès Open Street Map à partir de la fiche bibliothèque. + \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/LibrariesMap.php b/library/ZendAfi/View/Helper/LibrariesMap.php index 0848c6a23fda4167aabaf1f46801de80cc8f0605..7a2d8cf39830452e713887223879bdf197539074 100644 --- a/library/ZendAfi/View/Helper/LibrariesMap.php +++ b/library/ZendAfi/View/Helper/LibrariesMap.php @@ -51,8 +51,8 @@ class ZendAfi_View_Helper_LibrariesMap extends ZendAfi_View_Helper_BaseHelper { : ''); $osm_layer = json_encode(isset($preferences['osm_layer']) - ? $preferences['osm_layer'] - : '0'); + ? $preferences['osm_layer'] + : 1); return $this->_tag('div', '', ['id' => $container_id, 'class' => 'leaflet_osm', diff --git a/tests/library/ZendAfi/View/Helper/LibrariesMapTests.php b/tests/library/ZendAfi/View/Helper/LibrariesMapTests.php index 9e60a0519d790a245052de4d69628c699dbe9026..cc2f5a57d3a63b22ba677db4150f7ca347cb03f2 100644 --- a/tests/library/ZendAfi/View/Helper/LibrariesMapTests.php +++ b/tests/library/ZendAfi/View/Helper/LibrariesMapTests.php @@ -73,4 +73,41 @@ class ZendAfi_View_Helper_Accueil_LibrariesMapTest extends ViewHelperTestCase { public function dataOsmLayerShouldBe1() { $this->assertXPath($this->html, '//div[contains(@data-osm-layer, "1")]'); } +} + + + + +class ZendAfi_View_Helper_Accueil_LibrariesMapWithOutPreferencesTest extends ViewHelperTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Lieu', + ['id' => 78, + 'libelle' => 'Cran-Gevrier']); + + $this->fixture('Class_Lieu', + ['id' => 65, + 'libelle' => 'Valleiry']); + + $libraries = [$this->fixture('Class_Bib', ['id' => 3, + 'libelle' => 'Cran-Gévrier', + 'id_lieu' => 78]), + + $this->fixture('Class_Bib', ['id' => 89, + 'libelle' => 'Valleiry', + 'id_lieu' => 65])]; + + $this->_helper = new ZendAfi_View_Helper_LibrariesMap(); + $this->_helper->setView(new ZendAfi_Controller_Action_Helper_View()); + $this->html = $this->_helper->librariesMap($libraries, '1'); + } + + + /** @test */ + public function osmLayerShouldBe1() { + $this->assertXpath($this->html, '//div[@data-osm-layer="1"]'); + } } \ No newline at end of file