From 24e4eb7e7f3a18cda389c4a3a199e1f6ef2eec9e Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@afi-sa.fr> Date: Mon, 20 Jan 2014 18:26:44 +0100 Subject: [PATCH] =?UTF-8?q?rel=20#8257=20:=20correction=20chargement=20dur?= =?UTF-8?q?=C3=A9e=20en=20modification=20m=C3=A9dia=20d'album?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/ZendAfi/Form/Album/Ressource.php | 6 ++++++ .../AlbumControllerPharoVideosTest.php | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/library/ZendAfi/Form/Album/Ressource.php b/library/ZendAfi/Form/Album/Ressource.php index 25b2e5d7886..4b4229640db 100644 --- a/library/ZendAfi/Form/Album/Ressource.php +++ b/library/ZendAfi/Form/Album/Ressource.php @@ -31,6 +31,7 @@ class ZendAfi_Form_Album_Ressource extends ZendAfi_Form { $form ->populate($model->toArray()) + ->addDurationFor($model) ->addFileFor($model) ->addPosterFor($model) ->detectMediaType($model) @@ -87,6 +88,11 @@ class ZendAfi_Form_Album_Ressource extends ZendAfi_Form { } + public function addDurationFor($model) { + $this->duration->setValue($model->getDuration()); + return $this; + } + /** * @param $album Class_AlbumRessource * @return ZendAfi_Form_Album_Ressource diff --git a/tests/application/modules/admin/controllers/AlbumControllerPharoVideosTest.php b/tests/application/modules/admin/controllers/AlbumControllerPharoVideosTest.php index 0aa53d04d48..a2539ff97ee 100644 --- a/tests/application/modules/admin/controllers/AlbumControllerPharoVideosTest.php +++ b/tests/application/modules/admin/controllers/AlbumControllerPharoVideosTest.php @@ -109,4 +109,24 @@ class Admin_AlbumControllerPharoVideosPostAddTest extends Admin_AlbumControllerP $notice = $this->new_ressource->getAlbum()->getNotice(); $this->assertContains('00:20:00', $notice->get_subfield('464','a')); } +} + + +class Admin_AlbumControllerPharoVideosEditTest extends Admin_AlbumControllerPharoVideosTestCase { + public function setUp() { + parent::setUp(); + $this->fixture('Class_AlbumRessource', ['id' => 37, + 'url' => 'http://www.pharocast.org', + 'media_type' => 3, + 'duration' => '00:20:00', + 'titre' => 'Pharo cast', + 'album' => Class_Album::find(777)]); + $this->dispatch('/admin/album/edit_ressource/id/37', true); + } + + + /** @test */ + public function durationShouldBe20Minutes() { + $this->assertXPath( '//input[@type="text"][@name="duration"][@value="00:20:00"]'); + } } \ No newline at end of file -- GitLab