Overwriting App.fullBaseURL if changed using Router::baseURL()

This commit is contained in:
Jose Lorenzo Rodriguez 2013-06-05 23:57:16 +02:00
parent 4bc92b822e
commit 7b746ccb57
2 changed files with 4 additions and 0 deletions

View file

@ -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');

View file

@ -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'));
}
/**