diff --git a/library/ZendAfi/View/Helper/Album/RssFeedVisitor.php b/library/ZendAfi/View/Helper/Album/RssFeedVisitor.php index 8205c06affb4096c94a579fd6c7ecc029b1635ec..9862276cf9f16483a43770c1c5af685bdd52c979 100644 --- a/library/ZendAfi/View/Helper/Album/RssFeedVisitor.php +++ b/library/ZendAfi/View/Helper/Album/RssFeedVisitor.php @@ -51,15 +51,20 @@ class ZendAfi_View_Helper_Album_RssFeedVisitor extends Zend_View_Helper_Abstrac public function visitAlbum($album) { - $description = $album->getDescription(); + $this->appendTags($this->_channel, ['title' => $album->getTitre(), 'link' => $this->view->absoluteUrl($album->getPermalink()), - 'charset' => 'utf-8', - 'itunes:image' => $this->view->absoluteUrl($album->getPermalinkThumbnail()), - 'description' => $description, - 'itunes:summary' => $description, 'pubDate' => gmdate('r', strtotime($album->getDateMaj()))]); + + $itunes_image = $this->_channel->appendChild($this->_doc->createElement('itunes:image')); + $itunes_image->setAttribute('href', $this->view->absoluteUrl($album->getPermalinkThumbnail())); + + $description = $this->_channel->appendChild($this->_doc->createElement('description')); + $description->appendChild($this->_doc->createCDATASection($album->getDescription())); + + $summary = $this->_channel->appendChild($this->_doc->createElement('itunes:summary')); + $summary->appendChild($this->_doc->createCDATASection($album->getDescription())); } @@ -69,13 +74,18 @@ class ZendAfi_View_Helper_Album_RssFeedVisitor extends Zend_View_Helper_Abstrac $this->appendTags($item = $this->appendTag($this->_channel, 'item'), ['title' => $ressource->getTitre(), 'link' => $media_url, - 'description' => $ressource->getDescription(), 'itunes:order' => $ressource->getOrdre(), - 'itunes:image' => $this->view->absoluteUrl($ressource->getThumbnailUrl()), 'guid' => $media_url]); $enclosure = $item->appendChild($this->_doc->createElement('enclosure')); $enclosure->setAttribute('url', $media_url); $enclosure->setAttribute('type', Class_File_Mime::getType($ressource->getFileExtension())); + + $itunes_image = $item->appendChild($this->_doc->createElement('itunes:image')); + $itunes_image->setAttribute('href', $this->view->absoluteUrl($ressource->getThumbnailUrl())); + + $description = $item->appendChild($this->_doc->createElement('description')); + $description->appendChild($this->_doc->createCDATASection($ressource->getDescription())); + } } diff --git a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php index 195d684264997a9898e618f24234fefab7221b56..bdd4dba5dd6a6ddf29e16e94ef8490b5cdcca172 100644 --- a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php +++ b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php @@ -675,9 +675,8 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll /** @test */ public function itunesImageShouldBeNoticeThumbnail() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//channel/itunes:image', - 'http://localhost'.BASE_URL.'/bib-numerique/notice-thumbnail/id/999'); + $this->_xpath->assertXPath($this->_response->getBody(), + '//channel/itunes:image[@href="http://localhost'.BASE_URL.'/bib-numerique/notice-thumbnail/id/999"]'); } @@ -755,9 +754,8 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll /** @test */ public function firstItemItunesImageShouldBeMimiJolie() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//channel/item[1]/itunes:image', - 'http://localhost'.BASE_URL.'/userfiles/album/999/thumbs/media/mimi_jolie.png'); + $this->_xpath->assertXPath($this->_response->getBody(), + '//channel/item[1]/itunes:image[@href="http://localhost'.BASE_URL.'/userfiles/album/999/thumbs/media/mimi_jolie.png"]'); }