Skip to content
Snippets Groups Projects
Commit f47617a9 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch...

Merge branch 'dev#65119_50_commande_capv38_si_boite_article_vide_ne_pas_afficher_d_article' into 'master'

dev #65119 add error message in articles widget when configuration is not valid

See merge request !3043
parents 7f21b365 46113db7
Branches
Tags
2 merge requests!3297WIP: Master,!3043dev #65119 add error message in articles widget when configuration is not valid
Pipeline #6492 passed with stage
in 34 minutes and 37 seconds
- ticket #65119 : Boite d'articles : affichage d'un message d'erreur dans le contenu de la boite lorsque le tri par sélection est coché et qu'aucun article n'est sélectionné.
\ No newline at end of file
......@@ -21,6 +21,10 @@
class ZendAfi_View_Helper_Accueil_News extends ZendAfi_View_Helper_Accueil_Base {
protected $_articles = [];
protected function _renderHeadScriptsOn($script_loader) {
if ($this->isDisplayDiaporama())
$this->renderSlideShowScriptsOn($script_loader,
......@@ -42,7 +46,16 @@ class ZendAfi_View_Helper_Accueil_News extends ZendAfi_View_Helper_Accueil_Base
public function getHtml() {
$this->contenu = '';
$this->titre = $this->getHtmlTitre();
if (!$this->_isConfigurationValid()) {
$this->contenu = $this->view->tagError($this->_('Il y a un problème de configuration. Le tri par sélection est coché et aucun contenu n\'est sélectionné. Veuillez changer le tri ou sélectionner du contenu.'));
return $this->getHtmlArray();
}
if ($this->preferences['rss_avis'])
$this->rss_interne = $this->_getUrlFor('cms', 'rss');
$this->read_speaker_helper = new ZendAfi_View_Helper_ReadSpeaker();
// Sélection de catégories ou d'articles
......@@ -66,12 +79,18 @@ class ZendAfi_View_Helper_Accueil_News extends ZendAfi_View_Helper_Accueil_Base
$this->getArticles(Class_Article::filterByLocaleAndWorkflow($this->_articles, $this->preferences['status'])),
['class' => $content_class]);
$this->titre = $this->getHtmlTitre();
return $this->getHtmlArray();
}
if ($this->preferences['rss_avis'])
$this->rss_interne = $this->_getUrlFor('cms', 'rss');
return $this->getHtmlArray();
protected function _isConfigurationValid() {
if (!$order = $this->preferences['display_order'])
return true;
if (Class_Systeme_ModulesAccueil_News::SELECTION != $order)
return true;
return ($this->preferences['id_categorie'] || $this->preferences['id_items']);
}
......
......@@ -51,6 +51,7 @@ abstract class AbstractIndexControllerTelephoneWithModulesTest extends Telephone
'2' => ['division' => '1',
'type_module' => 'NEWS',
'preferences' => ['titre' => 'Concerts',
'display_order' => 'Random',
'rss_avis' => 0]],
'3' => ['division' => '1',
......@@ -194,7 +195,6 @@ class IndexControllerTelephoneWithoutPackMobileButBibNumTest extends AbstractInd
function boiteNewsShouldBeVisible() {
$this->assertXPath('//ul[@class="listview-news"]');
}
}
......@@ -657,6 +657,7 @@ class IndexControllerEmbedWithAccordionListWidgetTest extends AbstractIndexContr
'type_module' => 'NEWS',
'preferences' => ['titre' => 'Concerts Erik',
'rss_avis' => 0,
'display_order' => 'Random',
'style_liste' => 'accordion_list']]]]);
$this->dispatch('/', true);
}
......
......@@ -18,8 +18,6 @@
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php';
abstract class NewsHelperTestCase extends ViewHelperTestCase {
protected $_storm_default_to_volatile = true;
......@@ -72,11 +70,6 @@ class EmptyNewsHelperTest extends NewsHelperTestCase {
public function setUp() {
parent::setUp();
$this->article_wrapper
->whenCalled('getArticlesByPreferences')
->answers(array());
$params = array('type_module' => 'NEWS',
'division' => 2,
'preferences' => ['titre' => 'Rien à dire',
......@@ -89,13 +82,6 @@ class EmptyNewsHelperTest extends NewsHelperTestCase {
}
/** @test */
function getArticlesByPreferencesParamsShouldNotContainLangue() {
$prefs = $this->article_wrapper->getFirstAttributeForLastCallOn('getArticlesByPreferences');
$this->assertFalse(array_key_exists('langue', $prefs));
}
/** @test */
public function titreShouldBeRienADire() {
$this->assertXPathContentContains($this->html,
......@@ -118,24 +104,15 @@ class EmptyNewsHelperTest extends NewsHelperTestCase {
}
/** @test */
function contentClassShouldBeNews12AndNews() {
$this->assertXPath($this->html,
'//div[@class="contenu"]//div[@class="news-12 news"]',
$this->html);
/** @test **/
public function addNewsButtonShouldNotBeDisplay() {
$this->assertNotXPath($this->html, '//a[contains(@href,"admin/cms/add")]');
}
/** @test */
public function rssLinkShouldBePresent() {
$this->assertXPath($this->html,
'//div[@class="rss"]//a[contains(@href, "/cms/rss?id_module=12&id_profil=5&language=fr")]');
}
/** @test **/
public function addNewsButtonShouldNotBeDisplay() {
$this->assertNotXPath($this->html, '//a[contains(@href,"admin/cms/add")]');
public function configurationIssueMessageShouldBeDisplay() {
$this->assertXPathContentContains($this->html, '//p[@class="error"]', utf8_encode('Il y a un problème de configuration. Le tri par sélection est coché et aucun contenu n\'est sélectionné. Veuillez changer le tri ou sélectionner du contenu.'));
}
}
......@@ -198,7 +175,8 @@ class NewsHelperWithThreeArticlesAndRomaniaRequestedTest extends NewsHelperWithT
$params = array('type_module' => 'NEWS',
'division' => 2,
'preferences' => array('titre' => 'En Automne',
'rss_avis' => false,
'display_order' => 'Random',
'rss_avis' => true,
'display_titles_only' => false));
......@@ -247,6 +225,21 @@ class NewsHelperWithThreeArticlesAndRomaniaRequestedTest extends NewsHelperWithT
public function articleFeteDeLaPommeShouldNotBePresent() {
$this->assertNotXPathContentContains($this->html, '//div', utf8_encode('Fête de la pomme'));
}
/** @test */
public function contentClassShouldBeNews12AndNews() {
$this->assertXPath($this->html,
'//div[@class="contenu"]//div[@class="news-12 news"]',
$this->html);
}
/** @test */
public function rssLinkShouldBePresent() {
$this->assertXPath($this->html,
'//div[@class="rss"]//a[contains(@href, "/cms/rss?id_module=12&id_profil=5&language=fr")]');
}
}
......@@ -260,6 +253,7 @@ abstract class NewsHelperWithThreeArticlesPermissionsTestCase extends NewsHelper
'division' => 2,
'preferences' => ['titre' => 'En Hiver',
'rss_avis' => false,
'display_order' => 'Random',
'display_titles_only' => false,
'style_liste' => 'diaporama',
'op_largeur_img' => 200,
......@@ -350,6 +344,7 @@ class NewsHelperWithThreeArticlesWorkflowActivatedUserAdminTest
'division' => 2,
'preferences' => ['titre' => 'En Hiver',
'rss_avis' => false,
'display_order' => 'Random',
'display_titles_only' => false,
'style_liste' => 'diaporama',
'op_largeur_img' => 200,
......@@ -471,6 +466,7 @@ class NewsHelperWithThreeArticlesWorkflowActivatedUserAbonneTest extends NewsHel
'division' => 2,
'preferences' => array('titre' => 'En Hiver',
'allow_link_on_title' => false,
'display_order' => 'Random',
'anchor' => 'http://linux.org',
'rss_avis' => false,
'display_titles_only' => false,
......@@ -504,6 +500,7 @@ class NewsHelperWithThreeArticlesTest extends NewsHelperWithThreeArticlesTestCas
$params = ['type_module' => 'NEWS',
'division' => 2,
'preferences' => ['titre' => 'En Automne',
'display_order' => 'Random',
'anchor' => 'http://wiki.library-portal.org',
'rss_avis' => false,
'allow_link_on_title' => true,
......@@ -585,6 +582,7 @@ class NewsHelperWithThreeArticlesDisplayTitleOnlyTest extends NewsHelperWithThre
$params = array('type_module' => 'NEWS',
'division' => 2,
'preferences' => array('titre' => 'En Automne',
'display_order' => 'Random',
'rss_avis' => false,
'display_titles_only' => true));
......@@ -633,6 +631,7 @@ class NewsHelperWithThreeArticlesInDiaporamaNavigationModeTest extends NewsHelpe
$params = ['type_module' => 'NEWS',
'division' => 2,
'preferences' => ['titre' => 'Diaporama',
'display_order' => 'Random',
'rss_avis' => false,
'display_titles_only' => false,
'style_liste' => 'diaporama_navigation',
......@@ -683,6 +682,7 @@ class NewsHelperWithThreeArticlesInDiaporamaNavigationModeNextPreviousTest exten
$params = ['type_module' => 'NEWS',
'division' => 2,
'preferences' => ['titre' => 'Diaporama',
'display_order' => 'Random',
'rss_avis' => false,
'display_titles_only' => false,
'style_liste' => 'diaporama_navigation',
......@@ -724,6 +724,7 @@ class NewsHelperWithThreeArticlesInAccordionListTest extends NewsHelperWithThree
$params = ['type_module' => 'NEWS',
'division' => 2,
'preferences' => ['titre' => 'Diaporama',
'display_order' => 'Random',
'rss_avis' => false,
'display_titles_only' => false,
'style_liste' => 'accordion_list']];
......@@ -773,6 +774,7 @@ class NewsHelperWithThreeArticlesInWallModeTest extends NewsHelperWithThreeArtic
$params = ['type_module' => 'NEWS',
'division' => 2,
'preferences' => ['titre' => 'Another brick',
'display_order' => 'Random',
'rss_avis' => false,
'display_titles_only' => false,
'style_liste' => 'wall',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment