Skip to content

Commit c90e2cb

Browse files
committed
test: fix incorrect REQUEST_URI
The public is a folder, so should be end with `/`.
1 parent 408a7d1 commit c90e2cb

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

tests/system/Helpers/URLHelper/CurrentUrlTest.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ protected function tearDown(): void
6060

6161
public function testCurrentURLReturnsBasicURL()
6262
{
63-
$_SERVER['REQUEST_URI'] = '/public';
63+
$_SERVER['REQUEST_URI'] = '/public/';
6464
$_SERVER['SCRIPT_NAME'] = '/public/index.php';
6565

66-
$this->config->baseURL = 'http://example.com/public';
66+
$this->config->baseURL = 'http://example.com/public/';
6767

6868
$this->createRequest($this->config);
6969

@@ -73,10 +73,10 @@ public function testCurrentURLReturnsBasicURL()
7373
public function testCurrentURLReturnsAllowedHostname()
7474
{
7575
$_SERVER['HTTP_HOST'] = 'www.example.jp';
76-
$_SERVER['REQUEST_URI'] = '/public';
76+
$_SERVER['REQUEST_URI'] = '/public/';
7777
$_SERVER['SCRIPT_NAME'] = '/public/index.php';
7878

79-
$this->config->baseURL = 'http://example.com/public';
79+
$this->config->baseURL = 'http://example.com/public/';
8080
$this->config->allowedHostnames = ['www.example.jp'];
8181

8282
$this->createRequest($this->config);
@@ -104,10 +104,10 @@ private function createRequest(?App $config = null, $body = null, ?string $path
104104
public function testCurrentURLReturnsBaseURLIfNotAllowedHostname()
105105
{
106106
$_SERVER['HTTP_HOST'] = 'invalid.example.org';
107-
$_SERVER['REQUEST_URI'] = '/public';
107+
$_SERVER['REQUEST_URI'] = '/public/';
108108
$_SERVER['SCRIPT_NAME'] = '/public/index.php';
109109

110-
$this->config->baseURL = 'http://example.com/public';
110+
$this->config->baseURL = 'http://example.com/public/';
111111
$this->config->allowedHostnames = ['www.example.jp'];
112112

113113
$this->createRequest($this->config);
@@ -117,8 +117,7 @@ public function testCurrentURLReturnsBaseURLIfNotAllowedHostname()
117117

118118
public function testCurrentURLReturnsObject()
119119
{
120-
// Since we're on a CLI, we must provide our own URI
121-
$this->config->baseURL = 'http://example.com/public';
120+
$this->config->baseURL = 'http://example.com/public/';
122121

123122
$this->createRequest($this->config);
124123

@@ -131,7 +130,7 @@ public function testCurrentURLReturnsObject()
131130
public function testCurrentURLEquivalence()
132131
{
133132
$_SERVER['HTTP_HOST'] = 'example.com';
134-
$_SERVER['REQUEST_URI'] = '/public';
133+
$_SERVER['REQUEST_URI'] = '/public/';
135134
$_SERVER['SCRIPT_NAME'] = '/index.php';
136135

137136
$this->config->indexPage = '';
@@ -147,8 +146,7 @@ public function testCurrentURLInSubfolder()
147146
$_SERVER['REQUEST_URI'] = '/foo/public/bar?baz=quip';
148147
$_SERVER['SCRIPT_NAME'] = '/foo/public/index.php';
149148

150-
// Since we're on a CLI, we must provide our own URI
151-
$this->config->baseURL = 'http://example.com/foo/public';
149+
$this->config->baseURL = 'http://example.com/foo/public/';
152150

153151
$this->createRequest($this->config);
154152

@@ -168,7 +166,7 @@ public function testCurrentURLWithPortInSubfolder()
168166
$_SERVER['REQUEST_URI'] = '/foo/public/bar?baz=quip';
169167
$_SERVER['SCRIPT_NAME'] = '/foo/public/index.php';
170168

171-
$this->config->baseURL = 'http://example.com:8080/foo/public';
169+
$this->config->baseURL = 'http://example.com:8080/foo/public/';
172170

173171
$this->createRequest($this->config);
174172

@@ -200,7 +198,7 @@ public function testUriStringNoTrailingSlash()
200198
$_SERVER['HTTP_HOST'] = 'example.com';
201199
$_SERVER['REQUEST_URI'] = '/assets/image.jpg';
202200

203-
$this->config->baseURL = 'http://example.com';
201+
$this->config->baseURL = 'http://example.com/';
204202
$this->config->indexPage = '';
205203

206204
$this->createRequest($this->config);

0 commit comments

Comments
 (0)