diff --git a/library/ZendAfi/Form/Configuration/Widget/Activities.php b/library/ZendAfi/Form/Configuration/Widget/Activities.php index eb3169fd7b244291c58c866673b75d0874b55276..09224bf5e4c849c0ea46f13807abddff3d90ca6a 100644 --- a/library/ZendAfi/Form/Configuration/Widget/Activities.php +++ b/library/ZendAfi/Form/Configuration/Widget/Activities.php @@ -19,29 +19,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_Form_Configuration_Widget_Activities extends ZendAfi_Form_Configuration_Widget_Base { - - public function populate($datas) { - $this - ->addElement('activitiesSelector', - 'activities_selector', - ['label' => $this->_('Choisissez les activités à afficher'), - 'selected_activities'=> isset($datas['selected_activities']) ? $datas['selected_activities'] : '', - 'categories_selectable' => false]) - - ->addToSelectionGroup(['activities_selector']) - - ->addToDisplaySettingsGroup(['display_number', - 'display_order', - 'display_group_mode', - 'display_mode']); - - return parent::populate($datas); - } - +class ZendAfi_Form_Configuration_Widget_Activities + extends ZendAfi_Form_Configuration_Widget_Base { public function init() { parent::init(); + $this ->addElement('text', 'display_number', @@ -53,17 +36,32 @@ class ZendAfi_Form_Configuration_Widget_Activities extends ZendAfi_Form_Configur 'multiOptions' => [Class_Systeme_ModulesAccueil_Activities::ORDER_BY_SELECTION => $this->_('Par ordre de sélection'), Class_Systeme_ModulesAccueil_Activities::ORDER_BY_CONTRIBUTORS => $this->_('Par nombre de participants'), Class_Systeme_ModulesAccueil_Activities::ORDER_BY_CREATION_ID => $this->_('Par date de création (plus récent en premier)')]]) + ->addElement('radio', 'display_mode', ['label' => $this->_('Mode d\'affichage des sessions'), 'multiOptions' => [Class_Systeme_ModulesAccueil_Activities::DISPLAY_TABLE =>$this->_('Tableau'), Class_Systeme_ModulesAccueil_Activities::DISPLAY_BLOC => $this->_('Bloc')]]) + ->addElement('radio', 'display_group_mode', ['label' => $this->_('Mode d\'affichage des activities'), 'multiOptions' => [ Class_Systeme_ModulesAccueil_Activities::DISPLAY_NO_GROUP => $this->_('non groupé'), Class_Systeme_ModulesAccueil_Activities::DISPLAY_GROUP_BY_YEAR =>$this->_('groupé par année') - ]]); + ]]) + + ->addElement('activitiesSelector', + 'selected_activities', + ['label' => $this->_('Choisissez les activités à afficher'), + 'categories_selectable' => false]) + + ->addToSelectionGroup(['selected_activities']) + + ->addToDisplaySettingsGroup(['display_number', + 'display_order', + 'display_group_mode', + 'display_mode']) + ; } } \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Calendar.php b/library/ZendAfi/Form/Configuration/Widget/Calendar.php index c3d935ecece3fe289645eed56196f0ec526a2e3c..bc8daed7fcc74b9bebd29a89e7408e61da0cdcb5 100644 --- a/library/ZendAfi/Form/Configuration/Widget/Calendar.php +++ b/library/ZendAfi/Form/Configuration/Widget/Calendar.php @@ -42,7 +42,12 @@ class ZendAfi_Form_Configuration_Widget_Calendar extends ZendAfi_Form_Configurat ->addElement('DisplayMode', 'mode-affichage', - ['label' => $this->_('Mode d\'affichage des événements')]) + ['label' => $this->_('Mode d\'affichage des événements'), + 'multiOptions' => ['simple' => $this->_('mode liste simple'), + 'article' => $this->_('mode résumé d\'article'), + 'wall' => $this->_('mode mur'), + 'diaporama_navigation' => $this->_('Diaporama avec navigation'), + 'none' => $this->_('Ne pas afficher')]]) ->addElement('select', 'event_filter', @@ -90,13 +95,7 @@ class ZendAfi_Form_Configuration_Widget_Calendar extends ZendAfi_Form_Configurat public function populate($datas) { - $this->getElement('mode-affichage') - ->setSettings($datas) - ->setMultiOptions(['simple' => $this->_('mode liste simple'), - 'article' => $this->_('mode résumé d\'article'), - 'wall' => $this->_('mode mur'), - 'diaporama_navigation' => $this->_('Diaporama avec navigation'), - 'none' => $this->_('Ne pas afficher')]); + $this->getElement('mode-affichage')->setSettings($datas); $this->addElement('treeSelect', 'data_source', diff --git a/library/ZendAfi/Form/Decorator/ActivitiesSelector.php b/library/ZendAfi/Form/Decorator/ActivitiesSelector.php index 81a29751574b17a4b9bb06746f457a242683bcfd..3456c28f03cebb051235965fa032305ec1c7fc31 100644 --- a/library/ZendAfi/Form/Decorator/ActivitiesSelector.php +++ b/library/ZendAfi/Form/Decorator/ActivitiesSelector.php @@ -23,12 +23,11 @@ class ZendAfi_Form_Decorator_ActivitiesSelector extends Zend_Form_Decorator_Abstract { public function render($content) { $view = $this->_element->getView(); - $helper = $view->getHelper('TreeSelect'); - if (!$this->_element->isCategoriesSelectable()) - $helper->categoriesNotSelectable(); + $helper = $view->getHelper('TreeSelect'); + $helper->categoriesNotSelectable(); - return $helper->treeSelect($this->_element->getSelectedActivities(), + return $helper->treeSelect($this->_element->getValue(), '', true, $view->url(['module' => 'admin', @@ -36,6 +35,6 @@ class ZendAfi_Form_Decorator_ActivitiesSelector extends Zend_Form_Decorator_Abst 'action' => 'get']), 'form', null, - 'selected_activities'); + $this->_element->getName()); } } \ No newline at end of file diff --git a/library/ZendAfi/Form/Decorator/VersionCompare/ActivitiesSelector.php b/library/ZendAfi/Form/Decorator/VersionCompare/ActivitiesSelector.php new file mode 100644 index 0000000000000000000000000000000000000000..dc5af860a5857690b47e825f6c867cf9bb7e8155 --- /dev/null +++ b/library/ZendAfi/Form/Decorator/VersionCompare/ActivitiesSelector.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_Form_Decorator_VersionCompare_ActivitiesSelector + extends ZendAfi_Form_Decorator_VersionCompare_TreeSelect { + + protected $_current_separator = '-'; + + protected function _find($id) { + return Class_Activity::find($id); + } + + + protected function _labelOf($model) { + return $model->getLibelle(); + } +} diff --git a/library/ZendAfi/Form/Decorator/VersionCompare/DisplayMode.php b/library/ZendAfi/Form/Decorator/VersionCompare/DisplayMode.php new file mode 100644 index 0000000000000000000000000000000000000000..e177be7a81ba32a041ee4fd37c69cafe5bf80396 --- /dev/null +++ b/library/ZendAfi/Form/Decorator/VersionCompare/DisplayMode.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_Form_Decorator_VersionCompare_DisplayMode + extends ZendAfi_Form_Decorator_VersionCompare_Select { + +} diff --git a/library/ZendAfi/Form/Decorator/VersionCompare/DomainSelect.php b/library/ZendAfi/Form/Decorator/VersionCompare/DomainSelect.php index 531a7a5854b64eb36e573f2874d65ae7c34414e2..a5f246b5e5eb1e1462bc88c0d96db4e0e51b051d 100644 --- a/library/ZendAfi/Form/Decorator/VersionCompare/DomainSelect.php +++ b/library/ZendAfi/Form/Decorator/VersionCompare/DomainSelect.php @@ -21,57 +21,14 @@ class ZendAfi_Form_Decorator_VersionCompare_DomainSelect - extends ZendAfi_Form_Decorator_VersionCompare { + extends ZendAfi_Form_Decorator_VersionCompare_TreeSelect { - protected function _renderCurrentValue() { - return $this->_renderValue($this->_getCurrentIds()); + protected function _find($id) { + return Class_Catalogue::find($id); } - protected function _getCurrentIds() { - return $this->_getIds($this->getElement()->getValue(), ';'); - } - - - protected function _renderVersionValue() { - return $this->_renderValue($this->_getVersionIds()); - } - - - protected function _getVersionIds() { - $datas = $this->getOption('datas'); - - return $datas && array_key_exists($name = $this->getElement()->getName(), $datas) - ? $this->_getIds($datas[$name], '-') - : []; - } - - - protected function _formatValue($ids) { - if (!$ids) - return $this->_('Non renseigné'); - - $html = []; - foreach($ids as $id) - $html[] = $this->_tag('li', ($domain = Class_Catalogue::find($id)) - ? implode(' > ', $domain->getPathParts()) - : $this->_('Inconnu ou Supprimé')); - sort($html); - return $this->_tag('ul', implode('', $html)); - } - - - protected function _getIds($value, $separator) { - return $value ? explode($separator, $value) : []; - } - - - protected function _isModified() { - $current = $this->_getCurrentIds(); - $version = $this->_getVersionIds(); - sort($current); - sort($version); - - return $current != $version; + protected function _labelOf($model) { + return implode(' > ', $model->getPathParts()); } } diff --git a/library/ZendAfi/Form/Decorator/VersionCompare/Radio.php b/library/ZendAfi/Form/Decorator/VersionCompare/Radio.php new file mode 100644 index 0000000000000000000000000000000000000000..f0be30e02262b96100c1dad5575c6c2998c2a7d0 --- /dev/null +++ b/library/ZendAfi/Form/Decorator/VersionCompare/Radio.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_Form_Decorator_VersionCompare_Radio + extends ZendAfi_Form_Decorator_VersionCompare_Select{ + +} diff --git a/library/ZendAfi/Form/Decorator/VersionCompare/SortableConnectLists.php b/library/ZendAfi/Form/Decorator/VersionCompare/SortableConnectLists.php new file mode 100644 index 0000000000000000000000000000000000000000..5cb01be2f5338e1a155b823332fd4afa28a81c4c --- /dev/null +++ b/library/ZendAfi/Form/Decorator/VersionCompare/SortableConnectLists.php @@ -0,0 +1,80 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_Form_Decorator_VersionCompare_SortableConnectLists + extends ZendAfi_Form_Decorator_VersionCompare { + + protected function _renderCurrentValue() { + return $this->_renderValue($this->_getCurrentIds()); + } + + + protected function _getCurrentIds() { + return $this->_getIds($this->getElement()->getValue(), ';'); + } + + + protected function _renderVersionValue() { + return $this->_renderValue($this->_getVersionIds()); + } + + + protected function _getVersionIds() { + $datas = $this->getOption('datas'); + + return $datas && array_key_exists($name = $this->getElement()->getName(), $datas) + ? $this->_getIds($datas[$name], ';') + : []; + } + + + protected function _getIds($value, $separator) { + return $value ? explode($separator, $value) : []; + } + + + protected function _formatValue($ids) { + if (!$ids) + return $this->_('Non renseigné'); + + $options = $this->_element->getMultiOptions(); + $html = []; + foreach($ids as $id) + $html[] = $this->_tag('li', + array_key_exists($id, $options) + ? $options[$id] + : $this->_('Inconnu ou Supprimé')); + sort($html); + + return $this->_tag('ul', implode('', $html)); + } + + + protected function _isModified() { + $current = $this->_getCurrentIds(); + $version = $this->_getVersionIds(); + sort($current); + sort($version); + + return $current != $version; + } +} diff --git a/library/ZendAfi/Form/Decorator/VersionCompare/TreeSelect.php b/library/ZendAfi/Form/Decorator/VersionCompare/TreeSelect.php new file mode 100644 index 0000000000000000000000000000000000000000..7700312e5c24dd150028499d97de11b29cf79afa --- /dev/null +++ b/library/ZendAfi/Form/Decorator/VersionCompare/TreeSelect.php @@ -0,0 +1,93 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_Form_Decorator_VersionCompare_TreeSelect + extends ZendAfi_Form_Decorator_VersionCompare{ + + protected + $_version_separator = '-', + $_current_separator = ';'; + + + protected function _renderCurrentValue() { + return $this->_renderValue($this->_getCurrentIds()); + } + + + protected function _getCurrentIds() { + return $this->_getIds($this->getElement()->getValue(), + $this->_current_separator); + } + + + protected function _renderVersionValue() { + return $this->_renderValue($this->_getVersionIds()); + } + + + protected function _getVersionIds() { + $datas = $this->getOption('datas'); + + return $datas && array_key_exists($name = $this->getElement()->getName(), $datas) + ? $this->_getIds($datas[$name], $this->_version_separator) + : []; + } + + + protected function _formatValue($ids) { + if (!$ids) + return $this->_('Non renseigné'); + + $html = []; + foreach($ids as $id) + $html[] = $this->_tag('li', ($model = $this->_find($id)) + ? $this->_labelOf($model) + : $this->_('Inconnu ou Supprimé')); + sort($html); + return $this->_tag('ul', implode('', $html)); + } + + + protected function _getIds($value, $separator) { + return $value ? explode($separator, $value) : []; + } + + + protected function _isModified() { + $current = $this->_getCurrentIds(); + $version = $this->_getVersionIds(); + sort($current); + sort($version); + + return $current != $version; + } + + + protected function _find($id) { + return null; + } + + + protected function _labelOf($model) { + return ''; + } +} diff --git a/library/ZendAfi/Form/Element/ActivitiesSelector.php b/library/ZendAfi/Form/Element/ActivitiesSelector.php index 32a6f812bcd0a088d5c1300e2494d6c07bf2678c..8a2ed4b1ee3e4327a74de88ede81d553efe851df 100644 --- a/library/ZendAfi/Form/Element/ActivitiesSelector.php +++ b/library/ZendAfi/Form/Element/ActivitiesSelector.php @@ -21,40 +21,15 @@ class ZendAfi_Form_Element_ActivitiesSelector extends Zend_Form_Element { - protected - $_selected_activities, - $_categories_selectable = true; - public function __construct($spec, $options=null) { parent::__construct($spec, $options); + $decorators = $this->_decorators; $this->_decorators = ['ActivitiesSelector' => new ZendAfi_Form_Decorator_ActivitiesSelector()]; foreach ($decorators as $name => $value) $this->_decorators[$name] = $value; - $this->removeDecorator('ViewHelper'); - - } - - - public function setSelectedActivities($selected_activities) { - $this->_selected_activities = $selected_activities; - return $this; - } - - public function getSelectedActivities() { - return $this->_selected_activities; - } - - - public function setCategories_Selectable($selectable) { - $this->_categories_selectable = $selectable; - } - - - public function isCategoriesSelectable() { - return $this->_categories_selectable; + $this->removeDecorator('ViewHelper'); } } -?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/FormSortableConnectLists.php b/library/ZendAfi/View/Helper/FormSortableConnectLists.php index afa16c1a0f0d37a4c0bd9e78ae349ae1b60e52f2..d32461cda1d2354d100b92361cff61b0b2d1c56a 100644 --- a/library/ZendAfi/View/Helper/FormSortableConnectLists.php +++ b/library/ZendAfi/View/Helper/FormSortableConnectLists.php @@ -19,7 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_View_Helper_FormSortableConnectLists extends ZendAfi_View_Helper_BaseHelper { +class ZendAfi_View_Helper_FormSortableConnectLists + extends ZendAfi_View_Helper_BaseHelper { + const SEPARATOR = ';'; protected @@ -82,18 +84,13 @@ class ZendAfi_View_Helper_FormSortableConnectLists extends ZendAfi_View_Helper_B protected function _renderList($title, $values) { - $output = '<div><h2>' . $title . '</h2>'; - $output .= '<ul>'; - - foreach ($values as $value) { - $output .= sprintf('<li data-value="%s">%s</li>', - $value, - $this->_labels[$value]); - } - $output .= '</ul>'; - $output .= '</div>'; + $list = ''; + foreach ($values as $value) + $list .= $this->_tag('li', $this->_labels[$value], + ['data-value' => $value]); - return $output; + return $this->_tag('div', + $this->_tag('h2', $title) . $this->_tag('ul', $list)); } @@ -116,5 +113,3 @@ class ZendAfi_View_Helper_FormSortableConnectLists extends ZendAfi_View_Helper_B return $this; } } - -?> \ No newline at end of file diff --git a/tests/scenarios/Versionning/VersionningWidgetTest.php b/tests/scenarios/Versionning/VersionningWidgetTest.php index abe4d1bd352b45f913b1b5e030ff3faa1aff3acf..56af5ff1c10a6846d39eaa79dd9cd0cd840fd0f5 100644 --- a/tests/scenarios/Versionning/VersionningWidgetTest.php +++ b/tests/scenarios/Versionning/VersionningWidgetTest.php @@ -23,7 +23,8 @@ abstract class VersionningWidgetTestCase extends Admin_AbstractControllerTestCase { protected $_storm_default_to_volatile = true, - $_file_system; + $_file_system, + $_type_module; public function setUp() { parent::setUp(); @@ -35,7 +36,7 @@ abstract class VersionningWidgetTestCase extends Admin_AbstractControllerTestCas Class_Folder_Manager::setFileSystem($this->_file_system); $profil = $this->fixture('Class_Profil', ['id' => 1]); - $profil->updateModuleConfigAccueil(3, ['type_module' => 'NEWS', + $profil->updateModuleConfigAccueil(3, ['type_module' => $this->_type_module, 'division' => 1]) ->assertSave(); } @@ -52,7 +53,13 @@ abstract class VersionningWidgetTestCase extends Admin_AbstractControllerTestCas -class VersionningWidgetEditPostTest extends VersionningWidgetTestCase { +abstract class VersionningWidgetNewsTestCase extends VersionningWidgetTestCase { + protected $_type_module = 'NEWS'; +} + + + +class VersionningWidgetEditPostTest extends VersionningWidgetNewsTestCase { protected $_file_name, $_file_content, @@ -125,7 +132,7 @@ class VersionningWidgetEditPostTest extends VersionningWidgetTestCase { -class VersionningWidgetAccueilWithVersionsTest extends VersionningWidgetTestCase { +class VersionningWidgetNewsAccueilWithVersionsTest extends VersionningWidgetNewsTestCase { public function setUp() { parent::setUp(); @@ -158,7 +165,7 @@ class VersionningWidgetAccueilWithVersionsTest extends VersionningWidgetTestCase -class VersionningWidgetVersionTest extends VersionningWidgetTestCase { +class VersionningWidgetNewsVersionTest extends VersionningWidgetNewsTestCase { protected $_dialog = []; public function setUp() { @@ -219,7 +226,70 @@ class VersionningWidgetVersionTest extends VersionningWidgetTestCase { /** @test */ public function widgetTitleShouldBeMarkedAsModified() { $this->assertContains('<tr class="modified"><td class="droite"><label for="titre">Titre de la boite', - $this->_dialog['content'], $this->_dialog['content']); } +} + + + +class VersionningWidgetActivitiesVersionTest extends VersionningWidgetTestCase { + protected + $_type_module = 'ACTIVITIES_WIDGET', + $_dialog = []; + + public function setUp() { + parent::setUp(); + + Class_Adminvar::set('ACTIVITY', 1); + + $this->fixture('Class_Users', + ['id' => 33, + 'login' => 'Albator', + 'password' => 'arc4di4']); + + $this->fixture('Class_Activity', + ['id' => 1, + 'libelle' => 'Manga Workshop']); + + $this->fixture('Class_Activity', + ['id' => 2, + 'libelle' => 'Libre software craftmanship']); + + $this->_file_system + ->whenCalled('is_readable')->answers(true) + + ->whenCalled('scandir') + ->answers(['.', '..', + '2017-03-20_112408_33.json', + '2017-03-19_103345_32.json', + '2017-03-19_102612_32.json',]) + + ->whenCalled('file_get_contents') + ->answers(json_encode(["titre" => "Nos ateliers", + "id_categorie" => "", + "selected_activities" => "1-2", + "display_number" => "5", + "display_order" => "selection", + "display_group_mode" => "ByYear", + "display_mode" => "Block", + "boite" => "", + "rss_avis" => "1"])); + ; + + Class_Profil::find(1) + ->updateModuleConfigAccueil(3, + ['type_module' => $this->_type_module, + 'division' => 1, + 'preferences' => ['selected_activities' => '1-2']]); + + $this->dispatch('/admin/widget/version/id_profil/1/id/3/render/popup', true); + $this->_dialog = json_decode($this->_response->getBody(), true); + } + + + /** @test */ + public function selectedActivitiesShouldBePresent() { + $this->assertContains('Manga Workshop', $this->_dialog['content']); + $this->assertContains('Libre software craftmanship', $this->_dialog['content']); + } } \ No newline at end of file