Commit 8a4af4ce authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

hotline #67869 : tests

parent fb022a38
...@@ -108,10 +108,10 @@ class Class_MoteurRecherche { ...@@ -108,10 +108,10 @@ class Class_MoteurRecherche {
public function visitSerie($serie, $tri) { public function visitSerie($serie, $tri) {
list($clef, $type) = explode('-', $serie); $parts = explode('-', $serie);
$this->setCondition('clef_chapeau="' . $clef . '" '); $this->setCondition('clef_chapeau="' . $parts[0] . '" ');
if ($type) if (isset($parts[1]))
$this->setCondition('type_doc="' . $type . '"'); $this->setCondition('type_doc="' . $parts[1] . '"');
if ($tri == 'date_creation desc') if ($tri == 'date_creation desc')
$this->order_by = 'order by cast(tome_alpha as SIGNED INTEGER) desc'; $this->order_by = 'order by cast(tome_alpha as SIGNED INTEGER) desc';
......
...@@ -37,10 +37,10 @@ class NoticeLoader extends Storm_Model_Loader { ...@@ -37,10 +37,10 @@ class NoticeLoader extends Storm_Model_Loader {
public function findFirstNoticeForClefChapeau($clef) { public function findFirstNoticeForClefChapeau($clef) {
list($clef, $type) = explode('-', $clef); $parts = explode('-', $clef);
$params = ['clef_chapeau' => $clef]; $params = ['clef_chapeau' => $parts[0]];
if ($type) if (isset($parts[1]))
$params['type_doc'] = $type; $params['type_doc'] = $parts[1];
return $this->findFirstBy($params); return $this->findFirstBy($params);
} }
......
...@@ -64,8 +64,8 @@ class ZendAfi_View_Helper_TagCVSCriteresRecherche extends Zend_View_Helper_HtmlE ...@@ -64,8 +64,8 @@ class ZendAfi_View_Helper_TagCVSCriteresRecherche extends Zend_View_Helper_HtmlE
public function visitSerie($serie) { public function visitSerie($serie) {
list($clef, $type) = explode('-', $serie); $parts = explode('-', $serie);
$this->criteres[] = $clef; $this->criteres[] = $parts[0];
} }
......
<?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 RechercheControllerRechercheSimpleSerieTest
extends AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true,
$_search;
public function setUp() {
parent::setUp();
$this->_search = Class_MoteurRecherche::getInstance();
}
/** @test */
public function withoutTypeDocshouldQueryWithoutTypeDoc() {
$this->dispatch('recherche/simple/serie/PAPIERS/tri/date_creation+desc', true);
$this->assertEquals(' Where clef_chapeau="PAPIERS" ',
$this->_search->buildWherePartQuery());
}
/** @test */
public function withTypeDocshouldQueryWithTypeDoc() {
$this->dispatch('recherche/simple/serie/PAPIERS-2/tri/date_creation+desc', true);
$this->assertEquals(' Where clef_chapeau="PAPIERS" and type_doc="2"',
$this->_search->buildWherePartQuery());
}
}
Markdown is supported
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