From eb32b31dfcee08b46fe21899bed6734d2c4f067a Mon Sep 17 00:00:00 2001
From: efalcy <efalcy@git-test.afi-sa.fr>
Date: Wed, 3 Apr 2013 17:42:36 +0000
Subject: [PATCH] Test pour moteur de recherche avec selection bib

---
 tests/library/Class/MoteurRechercheTest.php | 24 ++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/tests/library/Class/MoteurRechercheTest.php b/tests/library/Class/MoteurRechercheTest.php
index 1d735b5216e..f3bb1777952 100644
--- a/tests/library/Class/MoteurRechercheTest.php
+++ b/tests/library/Class/MoteurRechercheTest.php
@@ -41,6 +41,8 @@ class MoteurRechercheAvanceeTest extends Storm_Test_ModelTestCase {
 
 
 	public function expectedSql() {
+		$lastyear = date('Y-m-d',mktime(0, 0, 0, date("m"),   date("d")-1,   date("Y")-1));
+		$last3months = date('Y-m-d',mktime(0, 0, 0, date("m"),   date("d"),   date("Y"))-3*30.5 * 24 * 3600);
 		return 		[
 			[ ['rech_auteurs' => 'Foucault', 'operateur_auteurs' => 'and', 'type_recherche' => 'fulltext', 'pertinence' => false, 'tri' => 'alpha_auteurs'] ,
 				'req_notices' => "Select id_notice from notices Where MATCH(auteurs) AGAINST('+(FOUCAULT FOUCAULTS FOUKOLT)' IN BOOLEAN MODE)  order by alpha_auteurs",
@@ -63,16 +65,28 @@ class MoteurRechercheAvanceeTest extends Storm_Test_ModelTestCase {
 				'req_facettes' => "select id_notice,type_doc,facettes from notices Where auteurs like 'CLASTRES%' And MATCH(facettes) AGAINST('+(YTUN YTAP) ' IN BOOLEAN MODE) And MATCH(facettes) AGAINST('+YMED1' IN BOOLEAN MODE) limit 15000"
 			]  ,
 
-			[ ['rech_sujets' => 'Philosophie', 'operateur_sujets' => 'and not',
+			[ ['rech_matieres' => 'Philosophie', 'operateur_matieres' => 'and not',
 				 'facette' => "T1",
 				 'annee_debut' => '1960',
 				 'annee_fin' => '2013',
 				 'nouveaute' => '12',
 				 'type_recherche' => 'commence', 'pertinence' => true, 'tri' => 'alpha_titres'] ,
-				'req_notices' => "Select id_notice from notices Where  not sujets like 'PHILOSOPHIE%' And MATCH(facettes) AGAINST('T1' IN BOOLEAN MODE) and annee >='1960'  and annee <='2013'  and date_creation >'2012-03-04'  order by alpha_titres",
-				'req_comptage' => "Select count(*) from notices  Where  not sujets like 'PHILOSOPHIE%' And MATCH(facettes) AGAINST('T1' IN BOOLEAN MODE) and annee >='1960'  and annee <='2013'  and date_creation >'2012-03-04' ",
-				'req_facettes' => "select id_notice,type_doc,facettes from notices Where  not sujets like 'PHILOSOPHIE%' And MATCH(facettes) AGAINST('T1' IN BOOLEAN MODE) and annee >='1960'  and annee <='2013'  and date_creation >'2012-03-04'  limit 15000"
-]  
+				'req_notices' => "Select id_notice from notices Where  not matieres like 'PHILOSOPHIE%' And MATCH(facettes) AGAINST('T1' IN BOOLEAN MODE) and annee >='1960'  and annee <='2013'  and date_creation >'".$lastyear."'  order by alpha_titres",
+				'req_comptage' => "Select count(*) from notices  Where  not matieres like 'PHILOSOPHIE%' And MATCH(facettes) AGAINST('T1' IN BOOLEAN MODE) and annee >='1960'  and annee <='2013'  and date_creation >'".$lastyear."' ",
+				'req_facettes' => "select id_notice,type_doc,facettes from notices Where  not matieres like 'PHILOSOPHIE%' And MATCH(facettes) AGAINST('T1' IN BOOLEAN MODE) and annee >='1960'  and annee <='2013'  and date_creation >'".$lastyear."'  limit 15000"
+				]  ,
+
+
+			[ [
+					'rech_titres' => 'Les nouveaux chiens de garde', 'operateur_titres' => 'and',
+					'rech_editeur' => 'Raisons d\'agir', 'operateur_editeur' => 'or',
+					'selection_bib'=> 'MED',
+					'nouveaute' => '3',
+					'type_recherche' => 'contient', 'pertinence' => false, 'tri' => 'alpha_titres'] ,
+				'req_notices' => "Select id_notice from notices Where titres like '+(NOUVEAU NOUVEAUX NOUVO) +(CHIEN CHIENS CHIN) +(GARDE GARDES GARD)%' or editeur like '+(RAISON RAISONS RAISON) +(D00 D00S ) +(AGIR AGIRS AJIR)%' And MATCH(facettes) AGAINST('+(MED) ' IN BOOLEAN MODE) and date_creation >'".$last3months."'  order by alpha_titres",
+				'req_comptage' => "Select count(*) from notices  Where titres like '+(NOUVEAU NOUVEAUX NOUVO) +(CHIEN CHIENS CHIN) +(GARDE GARDES GARD)%' or editeur like '+(RAISON RAISONS RAISON) +(D00 D00S ) +(AGIR AGIRS AJIR)%' And MATCH(facettes) AGAINST('+(MED) ' IN BOOLEAN MODE) and date_creation >'".$last3months."' ",
+				'req_facettes' => "select id_notice,type_doc,facettes from notices Where titres like '+(NOUVEAU NOUVEAUX NOUVO) +(CHIEN CHIENS CHIN) +(GARDE GARDES GARD)%' or editeur like '+(RAISON RAISONS RAISON) +(D00 D00S ) +(AGIR AGIRS AJIR)%' And MATCH(facettes) AGAINST('+(MED) ' IN BOOLEAN MODE) and date_creation >'".$last3months."'  limit 15000"
+				]  
 			
 
 
-- 
GitLab