diff --git a/VERSIONS_HOTLINE/#26007 b/VERSIONS_HOTLINE/#26007 new file mode 100644 index 0000000000000000000000000000000000000000..cb2005b4eea717e1052b3bf50a0e4719052cf66d --- /dev/null +++ b/VERSIONS_HOTLINE/#26007 @@ -0,0 +1 @@ +- ticket 26007: Tri des catégories d'articles par le libelle en list mode diff --git a/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php b/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php index 42dc4e3e44b9b7587afa001fa6bdd8ba51418ee3..1c8a613469e9d26d07ad6c05676f8d2902768a7e 100644 --- a/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php +++ b/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php @@ -62,7 +62,8 @@ class ZendAfi_Controller_Action_Helper_ArticleListViewMode extends ZendAfi_Contr public function getCategories() { $categories = (!$id_cat = $this->getParam('id_cat')) ? $this->getBib()->getArticleCategories() - : Class_ArticleCategorie::findAllBy(['id_cat_mere' => $id_cat]); + : Class_ArticleCategorie::findAllBy(['id_cat_mere' => $id_cat, + 'order' => 'libelle']); return $this->getFiltredCategories($categories); } diff --git a/tests/application/modules/admin/controllers/CmsControllerListModeTest.php b/tests/application/modules/admin/controllers/CmsControllerListModeTest.php index 18184b5b0a3245ad4d2965bbb7364c2088248c18..72043ba947ab5ebed5f3669de1c8e2ba2d2a5b28 100644 --- a/tests/application/modules/admin/controllers/CmsControllerListModeTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerListModeTest.php @@ -160,6 +160,16 @@ class CmsControllerListModeAdminBibSubCategoryTest 'titre' => 'Wtf', 'contenu' => 'Welcome', 'id_cat' => 1]); + $other_cat = $this->fixture('Class_ArticleCategorie', + ['id' => 2, + 'libelle' => 'Lyrics', + 'parent_categorie' => $this->root_category, + ]); + $other_cat->setBib($this->annecy); + $group = Class_UserGroup::find(22); + Class_ArticleCategorie::find(23)->setLibelle('Modes')->save(); + Class_Permission::createArticle()->permitTo($group, $other_cat); + Class_Permission::createArticleCategory()->permitTo($group, $other_cat); $this->dispatch('/admin/cms/index/id_cat/1', true); } @@ -168,7 +178,7 @@ class CmsControllerListModeAdminBibSubCategoryTest /** @test */ public function shouldDisplayLibraryInBreadcrumbAtRoot() { $this->assertXPathContentContains('//a[contains(@href, "admin/cms")]', - 'Annecy'); + 'Annecy',$this->_response->getBody()); } @@ -179,9 +189,16 @@ class CmsControllerListModeAdminBibSubCategoryTest /** @test */ - public function shouldDisplayALaUneCategory() { - $this->assertXPathContentContains('//td/a[contains(@href, "cms/index/id_cat/23")]', - 'A la Une'); + public function shouldDisplayModesCategory() { + $this->assertXPathContentContains('//tr[2]//td/a[1][contains(@href, "cms/index/id_cat/23")]', + 'Modes'); + } + + + /** @test */ + public function shouldDisplayLyricsCategoryBeforeModes() { + $this->assertXPathContentContains('//tr[1]//td/a[1][contains(@href, "cms/index/id_cat/2")]', + 'Lyrics'); } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 7e2d0ee9d87ed394148dda54456058aa72a06ce2..30811d21ce7d3cb6c74f4282a22a6f2f3a1fbe1c 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -122,17 +122,16 @@ abstract class CmsControllerTestCase extends Admin_AbstractControllerTestCase { public function setupBib() { - $this->annecy = Class_Bib::newInstanceWithId(1, ['id_zone' => 4, - 'libelle' => 'Annecy' - ]); - $this->annecy->save(); + $this->annecy = $this->fixture('Class_Bib',['id' => 1, + 'id_zone' => 4, + 'libelle' => 'Annecy' + ]); - - $this->cran_gevrier = Class_Bib::newInstanceWithId(3, ['id_zone' => 4, - 'libelle' => 'Cran-Gevrier', - 'article_categories' => []]); - $this->cran_gevrier->save(); + $this->cran_gevrier = $this->fixture('Class_Bib',['id' => 3, + 'id_zone' => 4, + 'libelle' => 'Cran-Gevrier', + 'article_categories' => []]); }