diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index 11bd6686999f668f187d516569c2a6b1580dfb25..890703fce8eea99542f8aa3ee7d0bcac26c18ad3 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -328,7 +328,9 @@ class CmsController extends Zend_Controller_Action { . $this->_request->getServer('HTTP_HOST') . $this->view->url($article->getUrl()), 'description' => html_entity_decode(Class_CmsUrlTransformer::imgUrlRelativeToAbsolute($article->getFullContent())), - 'lastUpdate' => strtotime($article->getDateMaj()) + 'lastUpdate' => strtotime($article->hasDebut() + ? $article->getDebut() + : $article->getDateMaj()) ]; } diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index 30545e04696b58dd41eef6c4ca2fc7a8e4fe1bde..d8ae1f500efdae18f4dd5344e05471a965a84e8f 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -77,47 +77,64 @@ extends AbstractControllerTestCase { Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') ->whenCalled('getArticlesByPreferences') - ->answers(array( - Class_Article::getLoader() - ->newInstanceWithId(1) - ->setTitre('La fête de la banane') - ->setContenu('Une fête qui glisse !<img src="'.BASE_URL.'/image/banane.jpg"/>') - ->setDateMaj('2011-11-11 11:11:11'), - Class_Article::getLoader() - ->newInstanceWithId(2) - ->setTitre('La fête de la frite') - ->setContenu('Une fête qui sent !'), - )); + ->answers([ + $this->fixture('Class_Article', + ['id' => 1, + 'titre' => 'La fête de la banane', + 'contenu' => 'Une fête qui glisse !<img src="'.BASE_URL.'/image/banane.jpg"/>']) + ->setDateMaj('2011-11-11 11:11:11'), + + $this->fixture('Class_Article', + ['id' => 2, + 'titre' => 'La fête de la frite', + 'contenu' => 'Une fête qui sent !', + 'debut' => '2012-12-12 12:12:12']), + ]); - $this->dispatch('cms/calendarrss?id_profil=2&id_module=1'); + $this->dispatch('cms/calendarrss?id_profil=2&id_module=1', true); } /** @test */ public function imgShouldBeDisplayWithAbsoluteUrl() { - $this->assertXPathContentContains('//description', '<img src="http://localhost'.BASE_URL.'/image/banane.jpg"'); + $this->assertXPathContentContains('//description', + '<img src="http://localhost'.BASE_URL.'/image/banane.jpg"'); } /** @test */ public function channelTitleShouldBeLesDernieresNouvelles() { - $this->assertXpathContentContains('//channel/title', 'Les dernières nouvelles'); + $this->assertXpathContentContains('//channel/title', + 'Les dernières nouvelles'); } + /** @test */ public function channelDescriptionShouldBeAgendaColonLesDerniereNouvelles() { - $this->assertXpathContentContains('//channel/description', 'Agenda: Les dernières nouvelles'); + $this->assertXpathContentContains('//channel/description', + 'Agenda: Les dernières nouvelles'); } + /** @test */ public function itemsCountShouldBeTwo() { $this->assertXpathCount('//channel/item', 2); } + /** @test */ public function firstItemDateShouldBe11_11_2011() { - $this->assertXpathContentContains('//channel/item/pubDate', '11 Nov 2011'); + $this->assertXpathContentContains('//channel/item/pubDate', + '11 Nov 2011'); + } + + + /** @test */ + public function secondItemDateShouldBe12_12_2012() { + $this->assertXpathContentContains('//channel/item/pubDate', + '12 Dec 2012', + $this->_response->getBody()); } }