Fix issues with tests and "subfolder" URLs

This commit is contained in:
Loz Calver 2015-07-31 09:42:35 +01:00 committed by Damian Mooyman
parent 790dff7b81
commit 99a8a81e9a
2 changed files with 4 additions and 3 deletions

View File

@ -328,7 +328,7 @@ class ControllerTest extends FunctionalTest {
*/ */
public function testRedirectBackByReferer() { public function testRedirectBackByReferer() {
$internalRelativeUrl = '/some-url'; $internalRelativeUrl = Controller::join_links(Director::baseURL(), '/some-url');
$internalAbsoluteUrl = Controller::join_links(Director::absoluteBaseURL(), '/some-url'); $internalAbsoluteUrl = Controller::join_links(Director::absoluteBaseURL(), '/some-url');
$response = $this->get('ControllerTest_Controller/redirectbacktest', null, $response = $this->get('ControllerTest_Controller/redirectbacktest', null,
@ -354,7 +354,7 @@ class ControllerTest extends FunctionalTest {
} }
public function testRedirectBackByBackUrl() { public function testRedirectBackByBackUrl() {
$internalRelativeUrl = '/some-url'; $internalRelativeUrl = Controller::join_links(Director::baseURL(), '/some-url');
$internalAbsoluteUrl = Controller::join_links(Director::absoluteBaseURL(), '/some-url'); $internalAbsoluteUrl = Controller::join_links(Director::absoluteBaseURL(), '/some-url');
$response = $this->get('ControllerTest_Controller/redirectbacktest?BackURL=' . urlencode($internalRelativeUrl)); $response = $this->get('ControllerTest_Controller/redirectbacktest?BackURL=' . urlencode($internalRelativeUrl));

View File

@ -366,10 +366,11 @@ class RequirementsTest extends SapphireTest {
$backend = new Requirements_Backend(); $backend = new Requirements_Backend();
$backend->set_suffix_requirements(false); $backend->set_suffix_requirements(false);
$src = $this->getCurrentRelativePath() . '/RequirementsTest_a.js'; $src = $this->getCurrentRelativePath() . '/RequirementsTest_a.js';
$urlSrc = Controller::join_links(Director::baseURL(), $src);
$backend->javascript($src); $backend->javascript($src);
$html = $backend->includeInHTML(false, $template); $html = $backend->includeInHTML(false, $template);
$this->assertEquals('<html><head></head><body><!--<script>alert("commented out");</script>-->' $this->assertEquals('<html><head></head><body><!--<script>alert("commented out");</script>-->'
. '<h1>more content</h1><script type="text/javascript" src="/' . $src . '"></script></body></html>', $html); . '<h1>more content</h1><script type="text/javascript" src="' . $urlSrc . '"></script></body></html>', $html);
} }
public function testForceJsToBottom() { public function testForceJsToBottom() {