Skip to content

Commit

Permalink
Overwriting App.fullBaseURL if changed using Router::baseURL()
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jun 5, 2013
1 parent 4bc92b8 commit 7b746cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Cake/Routing/Router.php
Expand Up @@ -920,6 +920,7 @@ public static function url($url = null, $full = false) {
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');
Expand Down
3 changes: 3 additions & 0 deletions lib/Cake/Test/Case/Routing/RouterTest.php
Expand Up @@ -50,6 +50,7 @@ public function tearDown() {
parent::tearDown();
CakePlugin::unload();
Router::baseURL('');
Configure::write('App.fullBaseURL', 'http://localhost');
}

/**
Expand All @@ -73,8 +74,10 @@ public function testBaseURL() {
$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'));
}

/**
Expand Down

0 comments on commit 7b746cc

Please sign in to comment.