Skip to content
Snippets Groups Projects
Commit aecdcf76 authored by Ghislain Loas's avatar Ghislain Loas Committed by Patrick Barroca
Browse files

dev #64923 add tests on librariesMap helper

parent 8952a3ae
Branches
Tags
3 merge requests!2430Dev#64923 contractuel concarneau personnaliser le fonds de la carte bib,!2421Dev#64923 contractuel concarneau personnaliser le fonds de la carte bib,!2419Dev#64923 contractuel concarneau personnaliser le fonds de la carte bib
......@@ -36,10 +36,10 @@ class ZendAfi_View_Helper_RenderLibrary extends ZendAfi_View_Helper_BaseHelper {
$this->library = $library;
$this->preferences = $preferences;
$label = (!$this->preferences['linked'])
? $this->library->getLibelle()
: $this->view->tagAnchor($this->library->getUrl(),
$this->library->getLibelle());
$label = (isset($this->preferences['linked']) && $this->preferences['linked'])
? $this->view->tagAnchor($this->library->getUrl(),
$this->library->getLibelle())
: $this->library->getLibelle();
return $this->_tag('section',
$this->_tag('h2', $label . $this->view->tagEditLibrary($library)) .
......@@ -48,7 +48,7 @@ class ZendAfi_View_Helper_RenderLibrary extends ZendAfi_View_Helper_BaseHelper {
protected function renderFields() {
$fields = $this->preferences['fields']
$fields = (isset($this->preferences['fields']) && $this->preferences['fields'])
? explode(';', $this->preferences['fields'])
: [];
......
......@@ -48,7 +48,6 @@ abstract class ZendAfi_View_Helper_Accueil_LibraryTestCase extends ViewHelperTes
'ouvertures' => $ouvertures,
'rewrite_url' => 'cran']);
$this->seynod = $this->fixture('Class_Bib',
['id' => 3,
'libelle' => 'Seynod',
......
<?php
/**
* Copyright (c) 2012-2017, 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 ZendAfi_View_Helper_Accueil_LibraryTestCase 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',
['geo_json' => 'userfiles/js/mon_geojson.geojson',
'osm_layer' => 1]);
}
/** @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 dataOsmGeoJsonShouldContainsMonGeoJson() {
$this->assertXPath($this->html, '//div[contains(@data-osm-geojson, "mon_geojson.geojson")]');
}
/** @test */
public function dataOsmLayerShouldBe1() {
$this->assertXPath($this->html, '//div[contains(@data-osm-layer, "1")]');
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment