mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
TEST Empty absolute urls - tests for #3323
This commit is contained in:
parent
37f88c8e1a
commit
04e5c11ed9
@ -96,6 +96,9 @@ class DirectorTest extends SapphireTest {
|
||||
$rootURL = Director::protocolAndHost();
|
||||
$_SERVER['REQUEST_URI'] = "$rootURL/mysite/sub-page/";
|
||||
Config::inst()->update('Director', 'alternate_base_url', '/mysite/');
|
||||
|
||||
//test empty URL
|
||||
$this->assertEquals($rootURL, Director::absoluteURL(''));
|
||||
|
||||
// Test already absolute url
|
||||
$this->assertEquals($rootURL, Director::absoluteURL($rootURL));
|
||||
@ -137,6 +140,7 @@ class DirectorTest extends SapphireTest {
|
||||
Config::inst()->update('Director', 'alternate_base_url', 'http://www.example.org/');
|
||||
$this->assertEquals('http://www.example.org/', Director::baseURL());
|
||||
$this->assertEquals('http://www.example.org/', Director::absoluteBaseURL());
|
||||
$this->assertEquals('http://www.example.org/', Director::absoluteURL(''));
|
||||
$this->assertEquals('http://www.example.org/subfolder/test', Director::absoluteURL('subfolder/test'));
|
||||
|
||||
// Setting it to false restores functionality
|
||||
|
@ -161,6 +161,12 @@ class HTTPTest extends SapphireTest {
|
||||
public function testAbsoluteURLsAttributes() {
|
||||
$this->withBaseURL('http://www.silverstripe.org/', function($test){
|
||||
|
||||
//empty links
|
||||
$test->assertEquals(
|
||||
'<a href="http://www.silverstripe.org/">test</a>',
|
||||
HTTP::absoluteURLs('<a href="">test</a>')
|
||||
);
|
||||
|
||||
// links
|
||||
$test->assertEquals(
|
||||
'<a href=\'http://www.silverstripe.org/blog/\'>SS Blog</a>',
|
||||
|
Loading…
Reference in New Issue
Block a user