diff --git a/VERSIONS_HOTLINE/136289 b/VERSIONS_HOTLINE/136289 new file mode 100644 index 0000000000000000000000000000000000000000..3224022fc29e512b38a1b7c9740ab61e959ebc7a --- /dev/null +++ b/VERSIONS_HOTLINE/136289 @@ -0,0 +1 @@ + - ticket #136289 : Système : Correction du non chargement des skins diff --git a/library/Class/AdminVar/Cookies.php b/library/Class/AdminVar/Cookies.php index ce945d23be4fa6754b2e4761bc7bc4436a0fe6be..20e7287508c8c320501ef7f49abf43bf340706c9 100644 --- a/library/Class/AdminVar/Cookies.php +++ b/library/Class/AdminVar/Cookies.php @@ -35,7 +35,10 @@ class Class_AdminVar_Cookies { } - public static function manager($view) { + public static function manager($view = null) { + if (!$view) + $view = ZendAfi_Controller_Action_Helper_ViewRenderer::getCurrentView(); + if (static::$manager) return static::$manager; diff --git a/library/Class/Cookies/Base.php b/library/Class/Cookies/Base.php index 0e3ad1d24044e57155ff0eede03de9fb35c8ffcd..c27e7d0d5bb68fbd117c5768379f3a19b291aaa0 100644 --- a/library/Class/Cookies/Base.php +++ b/library/Class/Cookies/Base.php @@ -35,7 +35,10 @@ class Class_Cookies_Base { } - public function __construct($view) { + public function __construct($view = null) { + if (!$view) + $view = ZendAfi_Controller_Action_Helper_ViewRenderer::getCurrentView(); + $this->_view = $view; } diff --git a/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php b/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php index 0bec9b470e4e9c0b104191be8e059f46f1345efe..46007e925ae92fec90347ff8ef5727bf9906e0e0 100644 --- a/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php +++ b/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php @@ -24,12 +24,28 @@ class ZendAfi_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Acti protected $_layoutScript = 'module.phtml', $_render_popup = false; + protected static $_current_view; public function __construct() { $options['viewSuffix'] = 'phtml'; $view = new ZendAfi_Controller_Action_Helper_View(); parent::__construct($view, $options); + $this->setCurrentView($this->view); + } + + + public function setCurrentView($view) { + if (isset(static::$_current_view)) + return $this; + + static::$_current_view = $view; + return $this; + } + + + public static function getCurrentView(){ + return static::$_current_view; } diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php index cf705d19e4ce715d717c065e15f10a5a732d79dc..16f646c46626f721f94ff74e796fb67fc3267b50 100644 --- a/tests/application/modules/AbstractControllerTestCase.php +++ b/tests/application/modules/AbstractControllerTestCase.php @@ -156,7 +156,7 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe Class_CriteresRecherche::setMaxSearchResults(''); Class_Systeme_Report_Portal::setIp('0.0.0.0'); Class_Systeme_ModulesMenu::reset(); - Class_AdminVar_Cookies::setManager(new Class_Cookies_Base(new ZendAfi_Controller_Action_Helper_View())); + Class_AdminVar_Cookies::setManager(new Class_Cookies_Base()); } diff --git a/tests/application/modules/admin/controllers/IndexControllerTest.php b/tests/application/modules/admin/controllers/IndexControllerTest.php index 9661f6984f3d091507cbd8643519617984e5fb48..26dac1e4cf6aca39b1ac81943e3692d2eed8ed16 100644 --- a/tests/application/modules/admin/controllers/IndexControllerTest.php +++ b/tests/application/modules/admin/controllers/IndexControllerTest.php @@ -65,7 +65,7 @@ class Admin_IndexControllerCookiesTest extends Admin_IndexControllerTestCase { public function setUp() { parent::setUp(); - Class_AdminVar_Cookies::setManager(new Class_Cookies_TarteAuCitron(new ZendAfi_Controller_Action_Helper_View())); + Class_AdminVar_Cookies::setManager(new Class_Cookies_TarteAuCitron()); } diff --git a/tests/scenarios/CookiesManager/AnalyticsTest.php b/tests/scenarios/CookiesManager/AnalyticsTest.php index 49962bde5e33e63c30e3e3da5993c942f3c6bd02..fcb165dc10e247cec605fbdb13642d80ec6ca569 100644 --- a/tests/scenarios/CookiesManager/AnalyticsTest.php +++ b/tests/scenarios/CookiesManager/AnalyticsTest.php @@ -137,4 +137,10 @@ _paq.push([\'enableLinkTracking\']); $this->dispatch('/index', true); $this->assertXPathContentContains('//script', "_paq.push(['setCustomVariable', 1, customvartitle_total", $this->_response->getBody()); } + + + /** @test */ + public function cookiesManagerShouldWorkWithoutViewSet() { + $this->assertNotNull(Class_AdminVar_Cookies::manager()); + } } \ No newline at end of file