From 0c70b042372ac43c096c9b23aa053a1ecb214e02 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Feb 2023 13:14:54 +0900 Subject: [PATCH] fix: disable setBaseURL() method --- system/HTTP/SiteURI.php | 8 ++++++++ tests/system/HTTP/SiteURITest.php | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/system/HTTP/SiteURI.php b/system/HTTP/SiteURI.php index 84488a307bca..9f5cbb56ba5a 100644 --- a/system/HTTP/SiteURI.php +++ b/system/HTTP/SiteURI.php @@ -180,6 +180,14 @@ private function setBasePath(string $baseURL): void } } + /** + * @deprecated + */ + public function setBaseURL(string $baseURL): void + { + throw new BadMethodCallException('Cannot use this method.'); + } + /** * @deprecated */ diff --git a/tests/system/HTTP/SiteURITest.php b/tests/system/HTTP/SiteURITest.php index 9a8caa3a7d95..578074ef5d6f 100644 --- a/tests/system/HTTP/SiteURITest.php +++ b/tests/system/HTTP/SiteURITest.php @@ -336,6 +336,16 @@ public function testSetURI() $uri->setURI('http://another.site.example.jp/'); } + public function testSetBaseURI() + { + $this->expectException(BadMethodCallException::class); + + $config = new App(); + $uri = new SiteURI($config); + + $uri->setBaseURL('http://another.site.example.jp/'); + } + public function testGetBaseURL() { $config = new App();