From c610e60fbf6a42b872f4f47aa0642856ca3c3a27 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@git-test.afi-sa.fr>
Date: Wed, 12 Sep 2012 14:58:50 +0000
Subject: [PATCH] =?UTF-8?q?Playlist=20Xspf:=20int=C3=A9gration=20des=20m?=
 =?UTF-8?q?=C3=A9dias=20externes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 library/Class/AlbumRessource.php                |  7 ++++++-
 .../controllers/BibNumeriqueControllerTest.php  | 17 ++++++++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/library/Class/AlbumRessource.php b/library/Class/AlbumRessource.php
index 158c1d12a31..43a3fcf823a 100644
--- a/library/Class/AlbumRessource.php
+++ b/library/Class/AlbumRessource.php
@@ -74,7 +74,9 @@ class Class_AlbumRessource extends Storm_Model_Abstract {
 		'description' => '',
 		'ordre' => 0,
 		'link_to' => '',
-		'matiere' => ''
+		'matiere' => '',
+		'vignette' => '',
+		'url' => ''
 	);
 
 	/**
@@ -509,6 +511,9 @@ class Class_AlbumRessource extends Storm_Model_Abstract {
 	 * @return string
 	 */
 	public function getOriginalUrl() {
+		if ($this->hasUrl())
+			return $this->getUrl();
+
 		return $this->getLocatedFile($this->getOriginalsUrl());
 	}
 
diff --git a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
index b3fd6da7d5d..2a9ba1ee427 100644
--- a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
+++ b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
@@ -517,7 +517,13 @@ class BibNumeriqueControllerAlbumMultiMediasTest extends AbstractControllerTestC
 											 Class_AlbumRessource::newInstanceWithId(4)
 											 ->setFichier('dark_night.mp4')
 											 ->setTitre('Batman Dark Knight')
-											 ->setVignette('batman.jpg')]);
+											 ->setVignette('batman.jpg'),
+
+
+											 Class_AlbumRessource::newInstanceWithId(4)
+											 ->setUrl('http://progressive.totaleclips.com.edgesuite.net/107/e107950_227.mp4')
+											 ->setTitre('Hunger Games')
+											 ->setVignette('hunger.jpg')]);
 
 		$this->dispatch('/opac/bib-numerique/album-xspf-playlist/id/999.xml', true);
 	}
@@ -565,6 +571,15 @@ class BibNumeriqueControllerAlbumMultiMediasTest extends AbstractControllerTestC
 																							'//xspf:playlist/xspf:trackList/xspf:track/xspf:title', 
 																							'Batman Dark Knight');
 	}
+
+
+	/** @test */
+	public function thirsTrackLocationShouldBeTotaleClipsDotCom() {
+		$this->_xpath->assertXPathContentContains($this->_response->getBody(), 
+																							'//xspf:playlist/xspf:trackList/xspf:track/xspf:location', 
+																							'http://progressive.totaleclips.com.edgesuite.net/107/e107950_227.mp4');
+	}
+
 }
 
 ?>
\ No newline at end of file
-- 
GitLab