From 76eecdb63bc1f0545cac97a72a0037dbc23562e5 Mon Sep 17 00:00:00 2001 From: llaffont <laurent.laffont@gmail.com> Date: Tue, 21 Jan 2014 17:33:30 +0100 Subject: [PATCH] =?UTF-8?q?Rendu=20des=20dates=20d'=C3=A9v=C3=A9nement=20d?= =?UTF-8?q?ans=20le=20calendrier:=20si=20la=20date=20de=20d=C3=A9but=20est?= =?UTF-8?q?=20la=20m=C3=AAme=20que=20la=20fin=20mais=20que=20l'heure=20dif?= =?UTF-8?q?f=C3=A8re,=20affiche=20"Le=20tel=20jour"=20au=20lieu=20"Du=20..?= =?UTF-8?q?.=20au=20..."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/ZendAfi/View/Helper/TagArticleEvent.php | 6 +++--- .../ZendAfi/View/Helper/TagArticleEventTest.php | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/library/ZendAfi/View/Helper/TagArticleEvent.php b/library/ZendAfi/View/Helper/TagArticleEvent.php index 7e8aa083310..7ec3735c19c 100644 --- a/library/ZendAfi/View/Helper/TagArticleEvent.php +++ b/library/ZendAfi/View/Helper/TagArticleEvent.php @@ -24,12 +24,12 @@ class ZendAfi_View_Helper_TagArticleEvent extends Zend_View_Helper_HtmlElement { * @return string */ public function tagArticleEvent($article) { - if (!$time_start = strtotime($article->getEventsDebut())) + if (!$time_start = strtotime(substr($article->getEventsDebut(), 0, 10))) return ''; - if (!$time_end = strtotime($article->getEventsFin())) + if (!$time_end = strtotime(substr($article->getEventsFin(), 0, 10))) $time_end = $time_start; - + $month_start = strftime('%B', $time_start); $month_end = strftime('%B', $time_end); if ($month_start == $month_end) diff --git a/tests/library/ZendAfi/View/Helper/TagArticleEventTest.php b/tests/library/ZendAfi/View/Helper/TagArticleEventTest.php index 1392a59927f..1f8d92e8ec5 100644 --- a/tests/library/ZendAfi/View/Helper/TagArticleEventTest.php +++ b/tests/library/ZendAfi/View/Helper/TagArticleEventTest.php @@ -63,6 +63,16 @@ class TagArticleEventTest extends ViewHelperTestCase { } + /** @test */ + function withEventDebutAndFinSameDayShouldAnswerLe05() { + $this->article + ->setEventsDebut('2011-09-05 08:00') + ->setEventsFin('2011-09-05 10:00'); + $this->assertTagContains('Le 05 septembre 2011'); + } + + + protected function assertTagContains($expected) { $this->assertEquals(sprintf('<span class="calendar_event_date">%s</span>', $expected), $this->_helper->tagArticleEvent($this->article)); -- GitLab