diff --git a/.gitattributes b/.gitattributes
index 726bb29def8c2b9ddffc84d27defeef8c178a6ae..3379fe1532d2ea5491a6cec2740ea3e7692a6fe6 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -5083,6 +5083,7 @@ tests/library/Class/MatiereTest.php -text
 tests/library/Class/MockMailTransport.php -text
 tests/library/Class/ModelTestCase.php -text
 tests/library/Class/ModeleFusionTest.php -text
+tests/library/Class/MoteurRechercheTest.php -text
 tests/library/Class/MultiUpload/FactoryTest.php -text
 tests/library/Class/MultiUpload/HandlersTest.php -text
 tests/library/Class/MultiUploadTest.php -text
diff --git a/tests/library/Class/MoteurRechercheTest.php b/tests/library/Class/MoteurRechercheTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..1d735b5216e857d0be5f58fd5a31a21f9ac93078
--- /dev/null
+++ b/tests/library/Class/MoteurRechercheTest.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * AFI-OPAC 2.0 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).
+ *
+ * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA 
+ */
+
+class MoteurRechercheAvanceeTest extends Storm_Test_ModelTestCase {
+	public function setUp() {
+		parent::setUp();
+
+		$this->_original_sql = Zend_Registry::get('sql');
+		$this->mock_sql = $this->getMockBuilder('Class_Systeme_Sql')
+                         			->disableOriginalConstructor()
+                        			->getMock();
+		Zend_Registry::set('sql', $this->mock_sql);
+
+		$this->criteres_recherche= new Class_CriteresRecherche();
+		$this->moteur_recherche = new Class_MoteurRecherche();
+	}
+
+
+	public function tearDown() {
+		Zend_Registry::set('sql', $this->_original_sql);
+		parent::tearDown();
+	}
+
+
+	public function expectedSql() {
+		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",
+				'req_comptage' => "Select count(*) from notices  Where MATCH(auteurs) AGAINST('+(FOUCAULT FOUCAULTS FOUKOLT)' IN BOOLEAN MODE) ",
+				'req_facettes' => "select id_notice,type_doc,facettes from notices Where MATCH(auteurs) AGAINST('+(FOUCAULT FOUCAULTS FOUKOLT)' IN BOOLEAN MODE)  limit 15000"
+				],
+
+		[ ['rech_auteurs' => 'Bourdieu', 'operateur_auteurs' => 'and', 'type_recherche' => 'commence', 'pertinence' => true, 'tri' => 'alpha_titres'] ,
+				'req_notices' => "Select id_notice from notices Where auteurs like 'BOURDIEU%' order by alpha_titres",
+				'req_comptage' => "Select count(*) from notices  Where auteurs like 'BOURDIEU%'",
+				'req_facettes' => "select id_notice,type_doc,facettes from notices Where auteurs like 'BOURDIEU%' limit 15000"
+			]  ,
+
+		[ ['rech_auteurs' => 'Clastres', 'operateur_auteurs' => 'and', 
+			 'annexe' => 'MED1',
+			 'selection_annexe' => 'TUN,TAP',
+'type_recherche' => 'commence', 'pertinence' => true, 'tri' => 'alpha_titres'] ,
+			'req_notices' => "Select id_notice from notices Where auteurs like 'CLASTRES%' And MATCH(facettes) AGAINST('+(YTUN YTAP) ' IN BOOLEAN MODE) And MATCH(facettes) AGAINST('+YMED1' IN BOOLEAN MODE) order by alpha_titres",
+			'req_comptage' => "Select count(*) from notices  Where auteurs like 'CLASTRES%' And MATCH(facettes) AGAINST('+(YTUN YTAP) ' IN BOOLEAN MODE) And MATCH(facettes) AGAINST('+YMED1' IN BOOLEAN MODE)",
+				'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',
+				 '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"
+]  
+			
+
+
+			];
+	}
+
+	/** 
+	 * @dataProvider expectedSql
+	 * @test 
+	 */
+			public function lancerRechercheAvanceeShouldBe($params, $req_notices, $req_comptage ,$req_facettes) {
+				
+				$this->mock_sql
+					->expects($this->once())
+					->method('fetchOne')
+					->with($req_comptage)
+					->will($this->returnValue(10));
+
+				$retour = $this->moteur_recherche->lancerRechercheAvancee($params);
+				$this->assertEquals(['nombre' => 10,
+														 'req_liste' => $req_notices,
+														 'req_facettes' => $req_facettes],
+														$retour);
+
+	}
+
+}
\ No newline at end of file