From 5499c8ea287880923f1c6cc1344ccf2d10c5f8ee Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-loas.afi-sa.net>
Date: Mon, 2 Jun 2014 16:14:04 +0200
Subject: [PATCH] adding test coverage on facette genre

---
 cosmogramme/php/classes/classe_notice_integration.php   | 2 +-
 cosmogramme/tests/php/classes/NoticeIntegrationTest.php | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php
index 47dbe693908..e4ee1ba6ef6 100644
--- a/cosmogramme/php/classes/classe_notice_integration.php
+++ b/cosmogramme/php/classes/classe_notice_integration.php
@@ -858,7 +858,7 @@ class notice_integration
 			foreach($this->notice["genres"] as $genre) 
 			{
 				$facettes[]="G".$genre." ";
-				$this->notice["full_dewey"].=fetchOne("select libelle from codif_genre where id_genre=$genre").' ';
+				$this->notice["full_dewey"].=fetchOne('select libelle from codif_genre where id_genre='.$genre).' ';
 			}
 		}
 		
diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php
index e1acbf6d623..e33ebda3878 100644
--- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php
+++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php
@@ -740,6 +740,15 @@ class NoticeIntegrationDimancheALaPiscineTest extends NoticeIntegrationTestCase
 		$this->assertEquals(8,	$this->notice_data['exemplaires'][0]['genre']);
 	}
 
+	
+	/** @test */
+	public function selectLibelleFormCodifGenreShouldHaveBeenCallIdGenre8() {
+		$this->assertTrue(
+			$this->_mock_sql
+			->methodHasBeenCalledWithParams('fetchOne', 
+																			['select libelle from codif_genre where id_genre=8']));
+	}
+	
 
 	/** @test */
 	public function exemplairesCountShouldBeOne() {
-- 
GitLab