From 9fc6a508ec96b78564a215718db575ff19437c65 Mon Sep 17 00:00:00 2001
From: llaffont <laurent.laffont@gmail.com>
Date: Sat, 25 Jan 2014 12:56:20 +0100
Subject: [PATCH] =?UTF-8?q?Pour=20les=20albums=20bib=20nums,=20la=20notice?=
 =?UTF-8?q?=20d=C3=A9taill=C3=A9e=20r=C3=A9cup=C3=A8re=20les=20titres=20en?=
 =?UTF-8?q?=20464$t?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 library/Class/Notice.php                      |  5 ++--
 ...echercheControllerAlbumAudioRecordTest.php | 23 +++++++++++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/library/Class/Notice.php b/library/Class/Notice.php
index b1d9e5dc24b..4cc5cbbef08 100644
--- a/library/Class/Notice.php
+++ b/library/Class/Notice.php
@@ -1063,9 +1063,8 @@ class Class_Notice extends Storm_Model_Abstract {
 	 * @return array
 	 */
 	protected function getZonesTitre() {
-		// Recup des zones titres dans les variables
-		$zones = fetchOne("Select valeur from variables where clef='unimarc_zone_titre'");
-		$zones = explode(';', trim($zones));
+		$zones = Class_CosmoVar::get('unimarc_zone_titre');
+		$zones = array_filter(explode(';', trim($zones)));
 		return $this->_getTitresDansZones($zones);
 	}
 
diff --git a/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php b/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php
index 8f54fd1e1a4..cf939a5726f 100644
--- a/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php
+++ b/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php
@@ -33,6 +33,8 @@ abstract class RechercheControllerAlbumAudioRecordTestCase extends AbstractContr
 		Class_Notice::setTimeSource(new TimeSourceForTest('2014-01-19 09:00:00'));
 		Class_Exemplaire::beVolatile();
 		Class_CodifAuteur::beVolatile();
+		Class_CosmoVar::newInstanceWithId('unimarc_zone_titre',
+																			['valeur' => '200$a;200$e;200$d;200$i;327$a;464$a;461$t;464$t']);
 
 		$album = $this->fixture('Class_Album',
 														['id' => 4,
@@ -158,4 +160,25 @@ class RechercheControllerAlbumAudioRecordViewMorceauxTest extends RechercheContr
 	}
 }
 
+
+
+
+class RechercheControllerAlbumAudioRecordViewDetailsTest extends RechercheControllerAlbumAudioRecordTestCase {
+	public function setUp() {
+		parent::setUp();
+		$this->dispatch('/opac/noticeajax/detail/id_notice/'.$this->_notice->getId(), true);
+	}
+
+	/** @test */
+	public function titresShouldContainsMoonchild() {
+		$this->assertXPathContentContains('//dd[@class="first"]//div', 'Moonchild');
+	}
+
+	/** @test */
+	public function titresShouldContainsIronMaidenAsCodeRebond() {
+		$this->assertXPathContentContains('//dd//a[contains(@href, "code_rebond/A1")]', 
+																			'Iron Maiden');
+	}
+}
+
 ?>
\ No newline at end of file
-- 
GitLab