diff --git a/library/ZendAfi/Form/Album/Ressource.php b/library/ZendAfi/Form/Album/Ressource.php index 25b2e5d7886fd5d8b3c3fd4c197cd9b79821eeb9..4b4229640db594ad9ec45a7c974d7b93b8714149 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 0aa53d04d4870e4f818feef666e08efddeb15513..a2539ff97ee5a5ff2cadafd609af4ba31197b726 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