diff --git a/library/ZendAfi/View/Helper/RenderAlbumPreview.php b/library/ZendAfi/View/Helper/RenderAlbumPreview.php index a185ddfe89513f1f17b056a68b0fc2a16428b9b5..9634f6fe5281a86ba4e176a2f714e7659c973db6 100644 --- a/library/ZendAfi/View/Helper/RenderAlbumPreview.php +++ b/library/ZendAfi/View/Helper/RenderAlbumPreview.php @@ -27,13 +27,11 @@ class ZendAfi_View_Helper_RenderAlbumPreview extends ZendAfi_View_Helper_BaseHel } - protected function _defaultRender($album, $link_options) { - $url = $this->view->url(['controller' => 'bib-numerique', - 'action' => 'view-album', - 'id' => $album->getId()]); - + protected function _defaultRender($album, $link_options, $container_options=[]) { return $this->_render($album, - array_merge($link_options, ['href' => $url])); + array_merge($link_options, + ['href' => $this->_albumUrl($album)]), + $container_options); } @@ -55,11 +53,7 @@ class ZendAfi_View_Helper_RenderAlbumPreview extends ZendAfi_View_Helper_BaseHel protected function _renderMultipleSite($album, $link_options) { - $html = ''; - foreach($album->getRessources() as $ressource) - $html .= $this->_tag('li', $this->_renderOneSite($ressource, $link_options)); - - return $album->getTitre() . $this->_tag('ul', $html); + return $this->_defaultRender($album, $link_options, ['class' => 'sitotheque']); } @@ -74,4 +68,11 @@ class ZendAfi_View_Helper_RenderAlbumPreview extends ZendAfi_View_Helper_BaseHel $this->_tag('h2', $link) . $item->getDescription(), $container_options); } + + + protected function _albumUrl($album) { + return $this->view->url(['controller' => 'bib-numerique', + 'action' => 'view-album', + 'id' => $album->getId()]); + } } \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php b/tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php index b9db9fe4cba022437b330d88e259432cf9d737d6..53184211b5a0c2120cf332536f2ebb975de22066 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php @@ -642,32 +642,18 @@ class BibNumeriqueViewCollectionSitothequesTest extends BibNumeriqueTestCase { /** @test */ - public function albumTitleShouldBePresent() { - $this->assertXPathContentContains($this->_html, '//li', 'Free Projects'); - } - - - /** @test */ - public function shouldDisplayLinkToBokeh() { + public function albumLinkShouldBePresentInASitothequeDiv() { $this->assertXPathContentContains($this->_html, - '//div[@class="sitotheque"]//a[contains(@href, "bokeh-library-portal.org")]', - 'Bokeh'); + '//div[@class="sitotheque"]//a[contains(@href, "/bib-numerique/view-album/id/8")]', + 'Free Projects'); } /** @test */ - public function shouldDisplayLinkToKoha() { - $this->assertXPathContentContains($this->_html, - '//div[@class="sitotheque"]//a[contains(@href, "koha-community.org")]', - 'Koha'); - } - - - /** @test */ - public function shouldDisplayLinkToKrita() { - $this->assertXPathContentContains($this->_html, - '//div[@class="sitotheque"]//a[contains(@href, "krita.org")]', - 'https://krita.org'); + public function shouldNotDisplayLinkToBokeh() { + $this->assertNotXPathContentContains($this->_html, + '//div[@class="sitotheque"]//a[contains(@href, "bokeh-library-portal.org")]', + 'Bokeh'); } }