From 3ebbf949489474bb8e99657751e43b58d1cef7db Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@git-test.afi-sa.fr>
Date: Tue, 26 Mar 2013 17:06:18 +0000
Subject: [PATCH] =?UTF-8?q?Ajout=20test=20pour=20v=C3=A9rifier=20le=20fonc?=
 =?UTF-8?q?tionnement=20vid=C3=A9os=20youtube?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../opac/controllers/NoticeajaxController.php |  3 ++-
 .../controllers/NoticeAjaxControllerTest.php  | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php
index 59d66bc2556..2b491f8da4c 100644
--- a/application/modules/opac/controllers/NoticeajaxController.php
+++ b/application/modules/opac/controllers/NoticeajaxController.php
@@ -294,7 +294,8 @@ class NoticeAjaxController extends Zend_Controller_Action {
 	public function videomorceauAction() {
 		if($this->service_afi > "")
 		{
-			$args=array("titre" => $_REQUEST["titre"], "auteur" => $_REQUEST["auteur"]);
+			$args=["titre" => $this->_getParam('titre'), 
+						 "auteur" => $this->_getParam('auteur')];
 			$data=Class_WebService_AllServices::runServiceAfi(9,$args);
 			$source=$data["source"];
 			$video=$data["video"];
diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
index 053166f99bc..4977c83cb2a 100644
--- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
+++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
@@ -516,4 +516,23 @@ class NoticeAjaxControllerNoticeActionTest extends AbstractControllerTestCase {
 	}
 }
 
+
+
+class NoticeAjaxControllerVideoMorceauTest extends AbstractControllerTestCase {
+	public function setUp() {
+		parent::setUp();
+		$this->dispatch('/opac/noticeajax/videomorceau?auteur=The%20Beatles&titre=Come%20together', true);
+	}
+
+
+	/** 
+	 * @group integration
+	 * @test 
+	 */
+	public function responseShouldContainsPlayer() {
+		$this->assertXPath('//param[@name="movie"][@value="http://youtube.googleapis.com/v/axb2sHpGwHQ&source=uds&autoplay=1"]',
+											 $this->_response->getBody());
+	}
+}
+
 ?>
\ No newline at end of file
-- 
GitLab