From 8080f865dcaae7b059be7f03d768e24c1d32dd9d Mon Sep 17 00:00:00 2001 From: Laurent Laffont <llaffont@afi-sa.fr> Date: Tue, 30 Jun 2020 15:23:13 +0200 Subject: [PATCH] hotline #113792 : Templaiting / Library Widget / OSM Map : fix geojson loading --- VERSIONS_HOTLINE/113792 | 1 + .../Intonation/View/LibrariesWidget.php | 2 +- tests/scenarios/Templates/TemplatesTest.php | 52 +++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 VERSIONS_HOTLINE/113792 diff --git a/VERSIONS_HOTLINE/113792 b/VERSIONS_HOTLINE/113792 new file mode 100644 index 00000000000..a3c35b5f35d --- /dev/null +++ b/VERSIONS_HOTLINE/113792 @@ -0,0 +1 @@ + - ticket #113792 : Magasin de thème / boîte bibliothèque : correction du chargement du fichier geojson \ No newline at end of file diff --git a/library/templates/Intonation/View/LibrariesWidget.php b/library/templates/Intonation/View/LibrariesWidget.php index a7661b178c0..52623dfebaa 100644 --- a/library/templates/Intonation/View/LibrariesWidget.php +++ b/library/templates/Intonation/View/LibrariesWidget.php @@ -72,7 +72,7 @@ class Intonation_View_LibrariesWidget extends ZendAfi_View_Helper_BaseHelper { ['fields' => $fields, 'linked' => 1, 'osm_layer' => $this->_settings->getOsmLayer(), - 'osm_geojson' => $this->_settings->getOsmGeojson()])) + 'geo_json' => $this->_settings->getGeoJson()])) : ''; } diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index 72300fcd418..3d12fb681b6 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -5409,4 +5409,56 @@ class TemplatesSuggestionAchatAddTest extends TemplatesIntonationTestCase { $this->assertXPathContentContains('//title', 'Suggérer un achat'); } +} + + + + +class TemplatesDispatchLibraryWidgetWithOSMTest extends TemplatesIntonationTestCase { + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Bib', + ['id' => 1, + 'libelle' => 'Annecy', + 'lieu' => $this->fixture('Class_Lieu', + ['id' => 9, + 'libelle' => 'Annecy', + 'latitude' => '1', + 'longitude' => '1'])]); + + Class_Profil::find(72) + ->setCfgAccueil(['modules' => + ['21' => ['division' => 3, + 'type_module' => 'LIBRARY', + 'preferences' => ['osm_map' => 1, + 'osm_layer' => 1, + 'geo_json' => 'files/my_geojson.geojson']]]]) + ->assertSave(); + $this->dispatch('/opac/index/index/id_profil/72'); + } + + + /** @test */ + public function scriptLoaderShouldContainsOpenStreetMapJs() { + $this->assertContains('openStreetMap.js', Class_ScriptLoader::getInstance()->html()); + } + + + /** @test */ + public function scriptLoaderShouldContainsOpenStreetMapCss() { + $this->assertContains('openStreetMap.css', Class_ScriptLoader::getInstance()->html()); + } + + + /** @test */ + public function dataOsmGeoJsonShouldContainsMyGeoJson() { + $this->assertXPath('//div[contains(@data-osm-geojson, "my_geojson.geojson")]'); + } + + + /** @test */ + public function dataOsmLayerShouldBe1() { + $this->assertXPath('//div[contains(@data-osm-layer, "1")]'); + } } \ No newline at end of file -- GitLab