Skip to content
Snippets Groups Projects
Commit e8735c35 authored by llaffont's avatar llaffont
Browse files

Correction affichage recherche dans les bibs de la boîte recherche

parent c1f755ce
No related merge requests found
......@@ -56,12 +56,12 @@ class ZendAfi_View_Helper_TagRechercheSimple extends Zend_View_Helper_HtmlElemen
public function renderSelectionBib() {
if ($this->preferences["select_bib"] !== 1)
if ((int)$this->preferences["select_bib"] !== 1)
return '';
return isset($_SESSION['selection_bib']['id_bibs'])
? '<input type="hidden" name="bib_select" value="'.$_SESSION['selection_bib']['id_bibs'].'" />'
: '<div>'. $_SESSION["selection_bib"]["html"] .'</div>';
return (isset($_SESSION['selection_bib']['id_bibs'])
? '<input type="hidden" name="bib_select" value="'.$_SESSION['selection_bib']['id_bibs'].'" />'
: ''). '<div>'. $_SESSION["selection_bib"]["html"] .'</div>';
}
......
......@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('ViewHelperTestCase.php');
class ZendAfi_View_Helper_TagRechercheSimpleTest extends ViewHelperTestCase {
/** @var ZendAfi_View_Helper_TagRechercheSimple */
protected $_helper;
......@@ -71,6 +73,19 @@ class ZendAfi_View_Helper_TagRechercheSimpleTest extends ViewHelperTestCase {
$html = $this->_helper->tagRechercheSimple($this->_preferences, 1);
$this->assertXPath($html, '//form//input[@name="expressionRecherche"][@placeholder="ex: Nineteen Eighty Four"]');
}
/** @test */
public function withSelectionBibShouldRenderSessionValue() {
$this->_preferences['select_bib'] = '1';
$_SESSION['selection_bib'] = ['html' => 'recherche dans des bibs',
'id_bibs' => '3,4,5'];
$html = $this->_helper->tagRechercheSimple($this->_preferences, 1);
$this->assertXPath($html, '//form//input[@name="bib_select"][@type="hidden"][@value="3,4,5"]');
$this->assertXPathContentContains($html, '//div', 'recherche dans des bibs');
}
}
?>
\ 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