File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212namespace CodeIgniter \HTTP ;
1313
1414use CodeIgniter \HTTP \Exceptions \RedirectException ;
15+ use CodeIgniter \I18n \Time ;
1516use CodeIgniter \Log \Logger ;
1617use CodeIgniter \Test \Mock \MockLogger as LoggerConfig ;
1718use Config \Services ;
@@ -67,8 +68,10 @@ public function testResponseWithoutStatusCode(): void
6768
6869 public function testLoggingLocationHeader (): void
6970 {
71+ Time::setTestNow ('2023-11-25 12:00:00 ' );
72+
7073 $ uri = 'http://location ' ;
71- $ expected = 'INFO - ' . date ('Y-m-d ' ) . ' --> REDIRECTED ROUTE at ' . $ uri ;
74+ $ expected = 'INFO - ' . Time:: now ()-> format ('Y-m-d ' ) . ' --> REDIRECTED ROUTE at ' . $ uri ;
7275 $ response = (new RedirectException (Services::response ()->redirect ($ uri )))->getResponse ();
7376
7477 $ logs = TestHandler::getLogs ();
@@ -80,8 +83,10 @@ public function testLoggingLocationHeader(): void
8083
8184 public function testLoggingRefreshHeader (): void
8285 {
86+ Time::setTestNow ('2023-11-25 12:00:00 ' );
87+
8388 $ uri = 'http://location ' ;
84- $ expected = 'INFO - ' . date ('Y-m-d ' ) . ' --> REDIRECTED ROUTE at ' . $ uri ;
89+ $ expected = 'INFO - ' . Time:: now ()-> format ('Y-m-d ' ) . ' --> REDIRECTED ROUTE at ' . $ uri ;
8590 $ response = (new RedirectException (Services::response ()->redirect ($ uri , 'refresh ' )))->getResponse ();
8691
8792 $ logs = TestHandler::getLogs ();
You can’t perform that action at this time.
0 commit comments