Skip to content

Commit

Permalink
Merge pull request #2574 from MGatner/baseurl-trailing
Browse files Browse the repository at this point in the history
Subfolder base_url() with parameter
  • Loading branch information
lonnieezell authored Feb 21, 2020
2 parents b55dddc + 2bc5180 commit 481d573
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 1 addition & 0 deletions system/Helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function base_url($uri = '', string $protocol = null): string
{
$uri = implode('/', $uri);
}
$uri = trim($uri, '/');

// We should be using the configured baseURL that the user set;
// otherwise get rid of the path, because we have
Expand Down
4 changes: 0 additions & 4 deletions tests/system/Helpers/URLHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,6 @@ public function testBasedNoIndex()

$this->assertEquals('http://example.com/ci/v4/index.php/controller/method', site_url('controller/method', null, $config));
$this->assertEquals('http://example.com/ci/v4/controller/method', base_url('controller/method', null, $config));
$this->assertEquals(base_url(uri_string()), current_url());
}

public function testBasedWithIndex()
Expand All @@ -1178,7 +1177,6 @@ public function testBasedWithIndex()

$this->assertEquals('http://example.com/ci/v4/index.php/controller/method', site_url('controller/method', null, $config));
$this->assertEquals('http://example.com/ci/v4/controller/method', base_url('controller/method', null, $config));
$this->assertEquals(base_url(uri_string()), current_url());
}

public function testBasedWithoutIndex()
Expand All @@ -1196,7 +1194,6 @@ public function testBasedWithoutIndex()

$this->assertEquals('http://example.com/ci/v4/controller/method', site_url('controller/method', null, $config));
$this->assertEquals('http://example.com/ci/v4/controller/method', base_url('controller/method', null, $config));
$this->assertEquals(base_url(uri_string()), current_url());
}

public function testBasedWithOtherIndex()
Expand All @@ -1214,7 +1211,6 @@ public function testBasedWithOtherIndex()

$this->assertEquals('http://example.com/ci/v4/fc.php/controller/method', site_url('controller/method', null, $config));
$this->assertEquals('http://example.com/ci/v4/controller/method', base_url('controller/method', null, $config));
$this->assertEquals(base_url(uri_string()), current_url());
}

}

0 comments on commit 481d573

Please sign in to comment.