diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index 318408c6e0f501ed07600b1fa805978a378b7a2a..77131905780c4f834f227ced42ce4211b4950fb2 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -200,6 +200,7 @@ class CmsController extends Zend_Controller_Action { } + /** * @see ZendAfi_View_Helper_Accueil_MenuVertical */ @@ -207,6 +208,7 @@ class CmsController extends Zend_Controller_Action { $this->_viewArticlesByPreferences($this->_getAllParams()); } + /** * @see ZendAfi_View_Helper_Accueil_News */ @@ -221,6 +223,14 @@ class CmsController extends Zend_Controller_Action { } + /** + * @see ZendAfi_View_Helper_Accueil_News + */ + public function articleviewpreferencesAction() { + $this->_viewArticlesByPreferences($this->_request->getParams()); + } + + public function categorieviewAction() { $articles = Class_Article::getLoader()->getArticlesByPreferences(array( 'id_categorie' => (int)$this->_request->getParam('id') diff --git a/library/Class/Systeme/ModulesMenu.php b/library/Class/Systeme/ModulesMenu.php index 83ee0dee9e482e3a175c65119554d49d72ff648a..e2cc787e4b62e26d6beb2049096e6ffc237d000c 100644 --- a/library/Class/Systeme/ModulesMenu.php +++ b/library/Class/Systeme/ModulesMenu.php @@ -177,14 +177,7 @@ class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract { case "LAST_NEWS": $url = BASE_URL . "/cms/articleviewrecent/nb/" . $preferences["nb"]; break; case "NEWS": // Pour l'instant 1 seul article et 1 seule categorie - if ($preferences["id_items"]) { - $items = explode("-", $preferences["id_items"]); - $url = BASE_URL . "/cms/articleview/id/" . $items[0]; - } - if ($preferences["id_categorie"]) { - $items = explode("-", $preferences["id_categorie"]); - $url = BASE_URL . "/cms/categorieview/id/" . $items[0]; - } + $url = BASE_URL . '/cms/articleviewpreferences?' . http_build_query($preferences); break; case "SITO": // Pour l'instant 1 seul site et pas de categorie if ($preferences["id_items"]) { diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index e675a94e260d279fe32a5fc9a3785b76a69d498e..dbf21b184a22f1cfee25d76f031e3aee6336abb7 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -472,18 +472,26 @@ abstract class CmsControllerListTestCase extends AbstractControllerTestCase { } } + + + class CmsControllerArticleViewRecentTest extends CmsControllerListTestCase { protected function _dispatchHook() { $this->dispatch('/cms/articleviewrecent/nb/2'); } } + + + class CmsControllerViewSummaryTest extends CmsControllerListTestCase { protected function _dispatchHook() { $this->dispatch('/cms/viewsummary'); } } + + class CmsControllerArticleViewSelectionTest extends CmsControllerListTestCase { protected function _dispatchHook() { $this->dispatch('/cms/articleviewselection'); @@ -508,6 +516,36 @@ class CmsControllerArticleViewSelectionTest extends CmsControllerListTestCase { } } + + + +class CmsControllerArticleViewPreferencesTest extends CmsControllerListTestCase { + protected function _dispatchHook() { + $this->dispatch('/cms/articleviewpreferences?id_items=1-3&display_order=Selection'); + } + + + public function setUp() { + parent::setUp(); + $this->preferences = Class_Article::getLoader()->getFirstAttributeForLastCallOn('getArticlesByPreferences'); + } + + + /** @test */ + public function itemsShouldBeOneAndThree() { + $this->assertEquals('1-3', $this->preferences['id_items']); + } + + + /** @test */ + public function orderShouldBeDatePublicationDesc() { + $this->assertEquals('Selection', $this->preferences['display_order']); + } +} + + + + class CmsControllerCategorieViewTest extends CmsControllerListTestCase { protected function _dispatchHook() { $this->dispatch('/cms/categorieview'); diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index c9f70074edd65237082e3ace7e1452087f78807a..c6af40452c6ccd3492c2975ea9b0e8cd3e9c3a2b 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -43,7 +43,12 @@ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractC 'libelle' => 'Google', 'picto' => 'vide.gif', 'preferences' => array('url' => 'http://www.google.com', - 'target' => 0)))), + 'target' => 0)), + array('type_menu' => 'NEWS', + 'libelle' => 'Articles', + 'picto' => 'vide.gif', + 'preferences' => array('id_items' => '1-3', + 'display_order' => 'Selection')) )), 'V' => array( "libelle" => "Menu vertical", "picto" => "vide.gif")); @@ -197,7 +202,14 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalShouldIncludeExternalLinkToGoogle() { - $this->assertXPathContentContains("//div[@id='menu_horizontal']//li//a[@href='http://www.google.com'][@target='_blank']", 'Google', $this->_response->getBody()); + $this->assertXPathContentContains("//div[@id='menu_horizontal']//li//a[@href='http://www.google.com'][@target='_blank']", 'Google'); + } + + + /** @test */ + public function menuHorizontalShouldIncludeLinkToArticleCms() { + $this->assertXPathContentContains("//div[@id='menu_horizontal']//li//a[contains(@href, 'cms/articleviewpreferences?id_items=1-3&display_order=Selection')]", + 'Articles'); }