From 2a1afc8207da60f1186404ed3bab45fbfcb8b61c Mon Sep 17 00:00:00 2001 From: lbrun <leo@sandbox.pergame.net> Date: Wed, 28 Oct 2015 09:46:11 +0100 Subject: [PATCH] dev#25728 : fix indent --- library/Class/Article.php | 2 ++ .../Controller/Action/Helper/RenderRss.php | 21 +++++++++++++++++++ .../controllers/AccueilControllerTest.php | 2 ++ .../opac/controllers/SitoControllerTest.php | 2 ++ 4 files changed, 27 insertions(+) diff --git a/library/Class/Article.php b/library/Class/Article.php index 24462d9a765..9ff6d9fb6cd 100644 --- a/library/Class/Article.php +++ b/library/Class/Article.php @@ -782,6 +782,7 @@ class Class_Article extends Storm_Model_Abstract { $this->setDateMaj(date('Y-m-d H:i:s', $this->getCurrentTime())); } + public function getPubDate() { if ($this->hasEventsDebut()) return $this->getEventsDebut(); @@ -792,6 +793,7 @@ class Class_Article extends Storm_Model_Abstract { return $this->getDateMaj(); } + public function beforeSave() { if ($this->isNew() && !$this->getDateCreation()) $this->setDateCreation($this->getDateMaj()); diff --git a/library/ZendAfi/Controller/Action/Helper/RenderRss.php b/library/ZendAfi/Controller/Action/Helper/RenderRss.php index ac1676a9251..2411ac33805 100644 --- a/library/ZendAfi/Controller/Action/Helper/RenderRss.php +++ b/library/ZendAfi/Controller/Action/Helper/RenderRss.php @@ -27,12 +27,14 @@ class ZendAfi_Controller_Action_Helper_RenderRss extends Zend_Controller_Action_ return new $class_name(); } + public function direct($id_profil, $id_module, $view, $type) { $this->_newStrategy($type)->render($id_profil,$id_module,$view,$this->getActionController()); } } + abstract class ZendAfi_Controller_Action_Helper_RenderRssAbstract { protected $action, $_view; @@ -66,21 +68,25 @@ abstract class ZendAfi_Controller_Action_Helper_RenderRssAbstract { $this->_renderRssFeed($datas, $data_rss); } + protected function getDescriptionForElement($data) { return html_entity_decode(Class_CmsUrlTransformer::imgUrlRelativeToAbsolute($this->_view->tagArticleEvent($data) . $data->getFullContent())); } + protected function getUrlLink($data) { return $this->action->getRequest()->getScheme() . '://' . $this->action->getRequest()->getServer('HTTP_HOST') . $this->_view->url($data->getUrl()); } + protected function lastUpdate($data) { return strtotime($data->getPubDate()); } + protected function _renderRssFeed($datas, $rss_array) { $entries = []; foreach ($datas as $data) { @@ -101,40 +107,49 @@ abstract class ZendAfi_Controller_Action_Helper_RenderRssAbstract { $this->action->getResponse()->setBody($feed->saveXML()); } + abstract protected function _getObjectDatas($id_module, $profil, $preferences); + protected function _getDescription() { return ''; } + protected function _getLink($profil, $id_module) { return ''; } + protected function getType() { return 'NEWS'; } } + class ZendAfi_Controller_Action_Helper_RenderRssSito extends ZendAfi_Controller_Action_Helper_RenderRssAbstract { protected function getType() { return 'SITO'; } + protected function getDescriptionForElement($data) { return html_entity_decode($data->getDescription()); } + protected function lastUpdate($data) { return strtotime($data->getDateMaj()); } + protected function getUrlLink($data) { return $data->getUrl(); } + protected function _getObjectDatas($id_module, $profil, $preferences) { return Class_Sitotheque::getSitesFromIdsAndCategories( explode('-', $preferences['id_items']), @@ -143,22 +158,26 @@ class ZendAfi_Controller_Action_Helper_RenderRssSito extends ZendAfi_Controller } + class ZendAfi_Controller_Action_Helper_RenderRssNews extends ZendAfi_Controller_Action_Helper_RenderRssAbstract { protected function _getObjectDatas($id_module, $profil, $preferences) { return Class_Calendar::getAllnextEvents($id_module, $profil); } + protected function _getDescription() { return 'Agenda: '; } + protected function _getLink($profil, $id_module) { return $profil->urlForModule('cms', 'articleviewbydate', $id_module); } } + class ZendAfi_Controller_Action_Helper_RenderRssArticle extends ZendAfi_Controller_Action_Helper_RenderRssAbstract { protected function _getObjectDatas($id_module, $profil, $preferences) { @@ -166,10 +185,12 @@ class ZendAfi_Controller_Action_Helper_RenderRssArticle extends ZendAfi_Control return Class_Article::filterByLocaleAndWorkflow($articles); } + protected function _getDescription() { return 'Articles: '; } + protected function _getLink($profil, $id_module) { return $profil->urlForModule('cms', 'viewselection', $id_module); } diff --git a/tests/application/modules/admin/controllers/AccueilControllerTest.php b/tests/application/modules/admin/controllers/AccueilControllerTest.php index 455316597f4..1478e833a80 100644 --- a/tests/application/modules/admin/controllers/AccueilControllerTest.php +++ b/tests/application/modules/admin/controllers/AccueilControllerTest.php @@ -311,11 +311,13 @@ class AccueilControllerConfigSitothequeDefaultsTest extends Admin_AbstractContro $this->assertXPath('//input[@type="radio"][@name="display_order"][@value="Random"]'); } + /** @test */ public function displayOrderSelectionShouldBePresent() { $this->assertXPath('//input[@type="radio"][@name="display_order"][@value="Selection"]'); } + /** @test */ public function rssFlowPreferenceShouldBePresent() { $this->assertXPath('//input[@type="checkbox"][@name="rss"]', $this->_response->getBody()); diff --git a/tests/application/modules/opac/controllers/SitoControllerTest.php b/tests/application/modules/opac/controllers/SitoControllerTest.php index f833fdb5ad2..fbc10f5a695 100644 --- a/tests/application/modules/opac/controllers/SitoControllerTest.php +++ b/tests/application/modules/opac/controllers/SitoControllerTest.php @@ -342,6 +342,7 @@ class SitoControllerRssWithProfileTest extends SitoControllerViewCategoryTestCas $this->dispatch('sito/sito-rss?id_module=1&id_profil=2'); } + /** @test */ public function rssShouldOnlyContainsTwoSitos() { $this->assertXPathCount('//item', 2,$this->_response->getBody()); @@ -379,6 +380,7 @@ class SitoControllerRssWithoutProfileTest extends AbstractControllerTestCase { $this->dispatch('sito/sito-rss'); } + /** @test */ public function titleShouldBeFluxIndisponible() { $this->assertXPathContentContains('//channel/title', 'Flux indisponible', $this->_response->getBody()); -- GitLab