diff --git a/library/ZendAfi/View/Helper/Article/RenderFullContent.php b/library/ZendAfi/View/Helper/Article/RenderFullContent.php index cfb3fb010c48aa3764a6e4fa47498365232650fe..b27c4ea50cb951ef704e9c3640e26118d349afd3 100644 --- a/library/ZendAfi/View/Helper/Article/RenderFullContent.php +++ b/library/ZendAfi/View/Helper/Article/RenderFullContent.php @@ -35,10 +35,13 @@ class ZendAfi_View_Helper_Article_RenderFullContent extends ZendAfi_View_Helper_ public function renderICalLink($article) { - return $this->view->tagICal(Class_Url::absolute(['controller' => 'cms', - 'action' => 'ical', - 'id_article' => $article->getId()]), - $this->view->_('Ajouter au calendrier')); + return + $article->hasEventsDebut() + ? $this->view->tagICal(Class_Url::absolute(['controller' => 'cms', + 'action' => 'ical', + 'id_article' => $article->getId()]), + $this->view->_('Ajouter au calendrier')) + : ''; } } diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index ef87de64f245bc2afc151eba94a245a6389721c1..6e42f0cf26ed7b7c37778a96d3022a56278ce8e1 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -819,8 +819,8 @@ class CmsControllerArticleViewByDateWithRadioFullArticleSelectedTest extends Abs /** @test */ public function feteDeLaBananeShouldContainsLinkToIcal() { - $this->assertXpath('//div[@class="ical"]/a[contains(@href, "/cms/ical/id_article/1")]', - $this->_response->getBody()); + $this->assertXpathContentContains('//a[@class="ical"][contains(@href, "/cms/ical/id_article/1")]', + 'Ajouter au calendrier'); } } @@ -844,9 +844,7 @@ abstract class CmsControllerWithFeteDeLaFriteTestCase extends AbstractController ['id' => '4156465', 'libelle' => 'Annecy', 'adresse' => 'Rue des tomates', - 'code_postal' => '74000', - 'latitude' => '45.9262592', - 'longitude' => '6.1459837']); + 'code_postal' => '74000']); $alimentaire = $this->fixture ( 'Class_ArticleCategorie', ['id' => 1, 'libelle' => 'Alimentaire', @@ -1171,7 +1169,7 @@ class CmsControllerArticleViewTest extends CmsControllerWithFeteDeLaFriteTestCas /** @test */ - public function withCurrentLocaleEnShouldReturnEnglishTranslation() { + function withCurrentLocaleEnShouldReturnEnglishTranslation() { $this->bootstrap(); Zend_Registry::get('session')->language = 'en'; $this->dispatch('/cms/articleview/id/224'); @@ -1186,14 +1184,14 @@ class CmsControllerArticleViewTest extends CmsControllerWithFeteDeLaFriteTestCas /** @test */ - public function divShouldContainsAdresseBonlieu() { + function divShouldContainsAdresseBonlieu() { $this->assertXPathContentContains('//div[@class="lieu"]', 'Annecy'); } /** @test */ - public function divShouldContainsStaticMap() { - $this->assertXPath('//div[@class="lieu"]//img[contains(@src,"https://smap.afi-sa.net/staticmap.php")]'); + function divShouldContainsGoogleMap() { + $this->assertXPath('//div[@class="lieu"]//img[contains(@src,"https://maps.googleapis.com/maps")]'); } @@ -1832,6 +1830,13 @@ class CmsControllerWithArticleWithWallKioskTest extends CmsControllerWithArticle } + /** @test */ + public function pageShouldNotContainsLinkToIcal() { + $this->assertNotXPath('//a[contains(@href, "/cms/ical")]'); + } + + + /** @test */ public function pageShouldContainsKiosk() { $this->assertXPath( '//div[@class="liste_mur"]');;