diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index a1c2db279df86111fe26551f56b018b9b7fca326..93eac1e46f7cb7caa738deb67c6f4b2605568364 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -58,9 +58,11 @@ class CmsController extends Zend_Controller_Action { $articles = Class_Article::getLoader()->filterByLocaleAndWorkflow($articles); $articles = Class_Article::getLoader()->groupByBibId($articles); + if ((count($articles) == 1) && isset($articles[0])) $libelle_bibs = [0 => '']; else { + $libelle_bibs = []; foreach(array_keys($articles) as $bib_id) $libelle_bibs[$bib_id] = Class_Bib::find($bib_id)->getLibelle(); } diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index e3646f91ddf2a57e7d9c8e191b855c6c6a8e58c1..d3a86cca344687e6e14d89050087cec5b8451625 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -333,7 +333,7 @@ class CmsControllerArticleViewByDateCategorie23AndNoProfilParamTest extends Abst ->answers(array()) ->getWrapper(); - $this->dispatch('/cms/articleviewbydate?d=2011-09-03&id_module=8&select_id_categorie=23'); + $this->dispatch('/cms/articleviewbydate?d=2011-09-03&id_module=8&select_id_categorie=23', true); } @@ -343,9 +343,10 @@ class CmsControllerArticleViewByDateCategorie23AndNoProfilParamTest extends Abst $this->assertEquals(23, $prefs['id_categorie']); } + /** @test */ function contenuShouldContainsAucunContenu() { - $this->assertXPathContentContains('//div', 'Aucun contenu'); + $this->assertXPathContentContains('//div', 'Aucun contenu', $this->_response->getBody()); } } diff --git a/tests/library/Class/ArticleLoaderTest.php b/tests/library/Class/ArticleLoaderTest.php index 84fa00097da259219a7844f5fd911ca61ea50e23..6823e6af7f8d5cf23954c50ea18857442d1d1d1d 100644 --- a/tests/library/Class/ArticleLoaderTest.php +++ b/tests/library/Class/ArticleLoaderTest.php @@ -424,21 +424,21 @@ extends ArticleLoaderGroupByBibTestCase { /** @test */ public function keysShouldBeBonlieuAndLaTurbine() { - $this->assertEquals(array('Bonlieu', 'La Turbine'), array_keys($this->articles)); + $this->assertEquals([1,2], array_keys($this->articles)); } /** @test */ public function firstArticleShouldBeGroupedUnderBonlieu() { $fixtures = $this->_getArticlesFixture(); - $this->assertEquals($fixtures[0], $this->articles['Bonlieu'][0]); + $this->assertEquals($fixtures[0], $this->articles[1][0]); } /** @test */ public function secondArticleShouldBeGroupedUnderLaTurbine() { $fixtures = $this->_getArticlesFixture(); - $this->assertEquals($fixtures[1], $this->articles['La Turbine'][0]); + $this->assertEquals($fixtures[1], $this->articles[2][0]); }