From 7b746ccb577de6193a6827bb71d46db300f1b355 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Wed, 5 Jun 2013 23:57:16 +0200 Subject: [PATCH] Overwriting App.fullBaseURL if changed using Router::baseURL() --- lib/Cake/Routing/Router.php | 1 + lib/Cake/Test/Case/Routing/RouterTest.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php index 615ac3186..5ea8d9558 100644 --- a/lib/Cake/Routing/Router.php +++ b/lib/Cake/Routing/Router.php @@ -920,6 +920,7 @@ class Router { public static function baseURL($base = null) { if ($base !== null) { self::$_baseURL = $base; + Configure::write('App.fullBaseURL', $base); } if (empty(self::$_baseURL)) { self::$_baseURL = Configure::read('App.fullBaseURL'); diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php index 4076e27ad..a88ed92ea 100644 --- a/lib/Cake/Test/Case/Routing/RouterTest.php +++ b/lib/Cake/Test/Case/Routing/RouterTest.php @@ -50,6 +50,7 @@ class RouterTest extends CakeTestCase { parent::tearDown(); CakePlugin::unload(); Router::baseURL(''); + Configure::write('App.fullBaseURL', 'http://localhost'); } /** @@ -73,8 +74,10 @@ class RouterTest extends CakeTestCase { $this->assertEquals(FULL_BASE_URL, Router::baseUrl()); Router::baseURL('http://example.com'); $this->assertEquals('http://example.com/', Router::url('/', true)); + $this->assertEquals('http://example.com', Configure::read('App.fullBaseURL')); Router::baseURL('https://example.com'); $this->assertEquals('https://example.com/', Router::url('/', true)); + $this->assertEquals('https://example.com', Configure::read('App.fullBaseURL')); } /**