Skip to content

Commit 5fa5305

Browse files
committed
feat: add getBaseURL() implementation
1 parent 9af4994 commit 5fa5305

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎system/HTTP/SiteURI.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@ public function setURI(?string $uri = null)
131131
throw new BadMethodCallException('Cannot use this method.');
132132
}
133133

134+
/**
135+
* Returns the baseURL.
136+
*
137+
* @interal
138+
*/
139+
public function getBaseURL(): string
140+
{
141+
return $this->baseURL;
142+
}
143+
134144
/**
135145
* Returns the URI path relative to baseURL.
136146
*

‎tests/system/HTTP/SiteURITest.php‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,12 @@ public function testSetURI()
250250

251251
$uri->setURI('http://another.site.example.jp/');
252252
}
253+
254+
public function testGetBaseURL()
255+
{
256+
$config = new App();
257+
$uri = new SiteURI($config);
258+
259+
$this->assertSame('http://example.com/', $uri->getBaseURL());
260+
}
253261
}

0 commit comments

Comments
 (0)