From 1e94f7a48597b06dbd0449024f1534c3388fab93 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@git-test.afi-sa.fr>
Date: Tue, 2 Apr 2013 08:59:07 +0000
Subject: [PATCH] Adaptations pour pouvoir skiner les notes des notices

---
 library/ZendAfi/View/Helper/NoteImg.php        |  3 ++-
 tests/library/ZendAfi/View/Helper/AvisTest.php | 14 +++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/library/ZendAfi/View/Helper/NoteImg.php b/library/ZendAfi/View/Helper/NoteImg.php
index 3d62dd2331c..46d5e7d11fc 100644
--- a/library/ZendAfi/View/Helper/NoteImg.php
+++ b/library/ZendAfi/View/Helper/NoteImg.php
@@ -24,7 +24,8 @@ class ZendAfi_View_Helper_NoteImg extends ZendAfi_View_Helper_BaseHelper {
 	public function noteImg($note) {
 		$img = URL_ADMIN_IMG."stars/stars-".str_replace(".",",",$note).".gif"; 
 
-		return sprintf('<img class="note_critique" alt="note: %d" src="%s" />',
+		return sprintf('<img class="note_critique note-%s" alt="note: %s" src="%s" />',
+									 str_replace('.', '', $note),
 									 $note,
 									 'http://' . $_SERVER['SERVER_NAME'] . sprintf(str_replace(",0","",$img)));
 	}
diff --git a/tests/library/ZendAfi/View/Helper/AvisTest.php b/tests/library/ZendAfi/View/Helper/AvisTest.php
index 739107054fb..0a782342ab0 100644
--- a/tests/library/ZendAfi/View/Helper/AvisTest.php
+++ b/tests/library/ZendAfi/View/Helper/AvisTest.php
@@ -75,12 +75,12 @@ class ViewHelperAvisTestWithAvisNotice extends ViewHelperTestCase {
 
 	public function testNoteIsFive() {
 		$this->assertXPath($this->html,
-											 "//div[@class='contenu_critique']//img[@class='note_critique'][@alt='note: 5']");
+											 "//div[@class='contenu_critique']//img[@class='note_critique note-5'][@alt='note: 5']");
 	}
 
 	public function testNoteImgIsStarsFive() {
 		$this->assertXPath($this->html,
-											 "//img[@class='note_critique'][contains(@src, 'stars-5.gif')]");
+											 "//img[@class='note_critique note-5'][contains(@src, 'stars-5.gif')]");
 	}
 
 	public function testAvisIsSuspenseIntense() {
@@ -142,7 +142,7 @@ class ViewHelperAvisTestWithoutAvisNoticeAndModeration extends ViewHelperTestCas
 			->setId(67)
 			->setEntete("Bof")
 			->setAvis("Pas\nterrible")
-			->setNote(2)
+			->setNote(2.5)
 			->setDateAvis('2010-01-02 10:00:00')
 			->setUser($tintin)
 			->setStatut(0)
@@ -175,14 +175,14 @@ class ViewHelperAvisTestWithoutAvisNoticeAndModeration extends ViewHelperTestCas
 	}
 
 
-	public function testNoteIsTwo() {
+	public function testNoteIsTwoFive() {
 		$this->assertXPath($this->html,
-											 "//div[@class='contenu_critique']//img[@class='note_critique'][@alt='note: 2']");
+											 "//div[@class='contenu_critique']//img[@class='note_critique note-25'][@alt='note: 2.5']", $this->html);
 	}
 
-	public function testNoteImgIsStarsTwo() {
+	public function testNoteImgIsStarsTwoFive() {
 		$this->assertXPath($this->html,
-											 "//img[@class='note_critique'][contains(@src,'stars-2.gif')]");
+											 "//img[@class='note_critique note-25'][contains(@src,'stars-2,5.gif')]");
 											 
 	}
 
-- 
GitLab