diff --git a/library/ZendAfi/View/Helper/Accueil/Base.php b/library/ZendAfi/View/Helper/Accueil/Base.php index ef4887bb8de331733b4a713f8f4312a1965074c2..c2439541e83e4521d437405724bf9d4246800c76 100644 --- a/library/ZendAfi/View/Helper/Accueil/Base.php +++ b/library/ZendAfi/View/Helper/Accueil/Base.php @@ -383,7 +383,7 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac $options->width = $preferences['op_navigation_window_width']; $options->height= $preferences['op_navigation_window_height']; $options->strategy = $preferences['op_navigation_mode']; - $options->cycle = $preferences['op_navigation_cycle']; + $options->cycle = isset($preferences['op_navigation_cycle']) ? $preferences['op_navigation_cycle'] : 0 ; Class_ScriptLoader::getInstance() ->addScript(URL_JAVA . 'slider_navigation/slider_navigation.js') diff --git a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php index d866eb135d66e21b36609539892e686ba62e35de..d74f9ca76f1c9f0fc45cf3248b9e69e1f3562153 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; @@ -155,8 +155,8 @@ class CalendarViewTodayWithEmptyPreferencesTest extends CalendarViewTodayTestCas /** @test */ public function cacheKeyShouldContainsParams() { $params = [2, - Class_Profil::getCurrentProfil()->getId(), - Zend_Registry::get('translate')->getLocale(), + Class_Profil::getCurrentProfil()->getId(), + Zend_Registry::get('translate')->getLocale(), $this->helper->getPreferences()]; $this->assertEquals(md5(serialize($params)), md5(serialize($this->helper->getCacheKey()))); } @@ -164,8 +164,8 @@ class CalendarViewTodayWithEmptyPreferencesTest extends CalendarViewTodayTestCas /** @test */ public function titreShouldBeAgendaAndLinkToArticleViewByDate() { - $this->assertXPathContentContains($this->html, - '//a[contains(@href, "/cms/articleviewbydate/id_module/2/id_profil/2")]', + $this->assertXPathContentContains($this->html, + '//a[contains(@href, "/cms/articleviewbydate/id_module/2/id_profil/2")]', 'Agenda'); } @@ -253,7 +253,7 @@ class CalendarViewTodayWithEmptyPreferencesTest extends CalendarViewTodayTestCas class CalendarViewTodayWithFriseChronoTest extends CalendarViewTodayTestCase { public function setUp() { parent::setUp(); - + $params = ['division' => '1', 'type_module' => 'CALENDAR', 'preferences' => ['titre' => 'Calendrier', @@ -261,7 +261,7 @@ class CalendarViewTodayWithFriseChronoTest extends CalendarViewTodayTestCase { 'id_categorie' => '', 'nb_events' => 1, 'display_calendar' => 2]]; - + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') ->whenCalled('getArticlesByPreferences') ->answers([]); @@ -305,7 +305,7 @@ class CalendarViewTodayWithFriseChronoTest extends CalendarViewTodayTestCase { /** @test */ public function monthsShouldBeSeparatedByGreaterThan() { $this->assertContains('</a><span>></span><a', $this->html); - + } @@ -348,7 +348,7 @@ class CalendarWithPreferencesNbEventsOneTest extends CalendarWithEmptyPreference 'events_only' => true, 'published' => true)) ->answers(array($this->nanook2, $this->opac4, $this->amber)) - + ->beStrict(); @@ -586,11 +586,11 @@ class CalendarWithWorkFlowStatusTest extends CalendarWithEmptyPreferencesTestCa 'limit' => 3, 'published' => true ]) - ->answers([$this->nanook2,$this->opac4, $this->amber]) + ->answers([$this->nanook2,$this->opac4, $this->amber]) ->beStrict(); $this->html = $this->helper->getBoite(); - + } /** @test */ @@ -610,7 +610,7 @@ class CalendarWithWorkFlowStatusTest extends CalendarWithEmptyPreferencesTestCa } - + class CalendarWithCategorySelectorAndRssPreferencesTest extends CalendarViewHelperTestCase { public function setUp() { parent::setUp(); @@ -637,7 +637,7 @@ class CalendarWithCategorySelectorAndRssPreferencesTest extends CalendarViewHelp 'events_only' => true, 'published' => false)) ->answers(array($this->nanook2, $this->opac4, $this->amber)) - + ->beStrict(); $this->html = $helper->getBoite(); @@ -844,7 +844,7 @@ class CalendarHelperWithDiaporamaNavigationModeTest extends CalendarViewHelperTe Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') ->whenCalled('getArticlesByPreferences') - ->answers([$this->fixture('Class_Article', + ->answers([$this->fixture('Class_Article', [ 'id' => 8, 'titre' => 'Bokeh en prod !', 'events_debut' => '2013-08-21', @@ -855,7 +855,7 @@ class CalendarHelperWithDiaporamaNavigationModeTest extends CalendarViewHelperTe - + $params = ['type_module' => 'CALENDRIER', 'division' => 2, 'preferences' => ['titre' => 'Agenda', @@ -869,17 +869,17 @@ class CalendarHelperWithDiaporamaNavigationModeTest extends CalendarViewHelperTe 'display_cat_select' => '', 'id_categorie' => '', 'mode-affichage' => 'diaporama_navigation', - 'op_navigation_window_width' => '350', + 'op_navigation_window_width' => '350', 'op_navigation_window_height' => '250', 'op_navigation_mode' => 'next_previous']]; - + $helper = new ZendAfi_View_Helper_Accueil_Calendar(12, $params); $helper->setView(new ZendAfi_Controller_Action_Helper_View()); $this->html = $helper->getBoite(); $this->_head_script = Class_ScriptLoader::getInstance()->html(); } - + /** @test */ public function javascriptForSlideshowShouldBeLoaded() { @@ -887,12 +887,12 @@ class CalendarHelperWithDiaporamaNavigationModeTest extends CalendarViewHelperTe '//script[contains(@src, "java/slider_navigation/slider_navigation.js")]'); } - + /** @test **/ public function sliderNavigationShouldBeCallForWidget12() { - $this->assertXPathContentContains($this->_head_script, + $this->assertXPathContentContains($this->_head_script, '//script[@type="text/javascript"]', - '$(function(){$("#boite_12").slider_navigation("' . BASE_URL . '" ,350,250,"next_previous");});', + '$(function(){$("#boite_12").slider_navigation({"width":"350","height":"250","strategy":"next_previous","cycle":0});});', $this->_head_script); } @@ -918,7 +918,7 @@ class CalendarHelperWithWallNavigationModeTest extends CalendarViewHelperTestCas Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') ->whenCalled('getArticlesByPreferences') - ->answers([$this->fixture('Class_Article', + ->answers([$this->fixture('Class_Article', [ 'id' => 8, 'titre' => 'Bokeh en prod !', 'events_debut' => '2013-08-21', @@ -929,7 +929,7 @@ class CalendarHelperWithWallNavigationModeTest extends CalendarViewHelperTestCas - + $params = ['type_module' => 'CALENDRIER', 'division' => 2, 'preferences' => ['titre' => 'Agenda', @@ -943,17 +943,17 @@ class CalendarHelperWithWallNavigationModeTest extends CalendarViewHelperTestCas 'display_cat_select' => '', 'id_categorie' => '', 'mode-affichage' => 'wall', - 'op_navigation_window_width' => '350', + 'op_navigation_window_width' => '350', 'op_navigation_window_height' => '250', 'op_navigation_mode' => 'next_previous']]; - + $helper = new ZendAfi_View_Helper_Accueil_Calendar(12, $params); $helper->setView(new ZendAfi_Controller_Action_Helper_View()); $this->html = $helper->getBoite(); $this->_head_script = Class_ScriptLoader::getInstance()->html(); } - + /** @test */ public function shouldDisplayArticle() { $this->assertXPath($this->html, @@ -967,7 +967,7 @@ class CalendarHelperWithWallNavigationModeTest extends CalendarViewHelperTestCas public function shouldContainsDaySelector() { $this->assertXPath( $this->html, "//span[contains(@class,'event_start_date_day')]" - + ); } @@ -977,7 +977,7 @@ class CalendarHelperWithWallNavigationModeTest extends CalendarViewHelperTestCas public function shouldContainsMonthSelector() { $this->assertXPath( $this->html, "//span[contains(@class,'event_start_date_month')]" - + ); }