From bcb92bdfa601893780e26c8c7cfca0ece3aeea5f Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@git-test.afi-sa.fr>
Date: Mon, 15 Oct 2012 16:28:42 +0000
Subject: [PATCH] =?UTF-8?q?Correction=20r=C3=A9cup=C3=A9ration=20r=C3=A9su?=
 =?UTF-8?q?m=C3=A9s=20=C3=A9diteurs=20suite=20=C3=A0=20maj=20site=20tiers?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 library/Class/WebService/Fnac.php                     | 11 +++++++++++
 .../controllers/SystemeControllerWebServicesTest.php  |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/library/Class/WebService/Fnac.php b/library/Class/WebService/Fnac.php
index f825fef0bcc..47bd501271c 100644
--- a/library/Class/WebService/Fnac.php
+++ b/library/Class/WebService/Fnac.php
@@ -62,6 +62,9 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
 
 
 	public function extractResumeFromHTML($html) {
+		if ($pos = striPos($html, "avisEdContent"))
+				return $this->extractLireLaSuiteDivAvisEditeurFromHTML($html);
+
 		if (!$pos = striPos($html, "laSuite bigLaSuite"))
 				return $this->extractLireLaSuiteDivFromHTML($html);
 
@@ -77,6 +80,14 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
 	}
 
 
+	public function extractLireLaSuiteDivAvisEditeurFromHTML($html) {
+		$pos = strPos($html, "avisEdContent") + 15;
+		$posfin = strPos($html, "</div>", $pos);
+		$resume = substr($html, $pos, ($posfin-$pos));
+		return trim($resume);
+	}
+
+
 	public function extractLireLaSuiteDivFromHTML($html) {
 		$start_string = "lireLaSuite mrg_v_sm";
 		if (!$pos = striPos($html, $start_string))
diff --git a/tests/application/modules/admin/controllers/SystemeControllerWebServicesTest.php b/tests/application/modules/admin/controllers/SystemeControllerWebServicesTest.php
index 7122485117f..6dbe60307ee 100644
--- a/tests/application/modules/admin/controllers/SystemeControllerWebServicesTest.php
+++ b/tests/application/modules/admin/controllers/SystemeControllerWebServicesTest.php
@@ -52,7 +52,7 @@ class SystemeControllerWebServicesActionTest extends Admin_AbstractControllerTes
 	public function webServiceFnacGetResumeShouldWork() {
 		$this->dispatch('/admin/systeme/webservices/id_service/Fnac/id_fonction/1');
 		$this->assertXPathContentContains('//pre[@class="resultat"]', 
-																			'Lisbeth et Mickael',
+																			'Tandis que Lisbeth Salander',
 																			$this->_response->getBody());
 	}
 
-- 
GitLab