diff --git a/composer.json b/composer.json
index 15ae178d5c6c..350c69184c18 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,7 @@
"phpunit/phpcov": "^9.0.2 || ^10.0",
"phpunit/phpunit": "^10.5.16 || ^11.2",
"predis/predis": "^3.0",
- "rector/rector": "2.1.0",
+ "rector/rector": "2.1.1",
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
},
"replace": {
diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php
index df2f217eb68a..a4216391b7ee 100644
--- a/tests/system/CodeIgniterTest.php
+++ b/tests/system/CodeIgniterTest.php
@@ -77,7 +77,7 @@ public function testRunEmptyDefaultRoute(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('Welcome to CodeIgniter', $output);
+ $this->assertStringContainsString('Welcome to CodeIgniter', (string) $output);
}
public function testOutputBufferingControl(): void
@@ -98,7 +98,7 @@ public function testRunEmptyDefaultRouteReturnResponse(): void
$response = $this->codeigniter->run(null, true);
$this->assertInstanceOf(ResponseInterface::class, $response);
- $this->assertStringContainsString('Welcome to CodeIgniter', $response->getBody());
+ $this->assertStringContainsString('Welcome to CodeIgniter', (string) $response->getBody());
}
public function testRunClosureRoute(): void
@@ -121,7 +121,7 @@ public function testRunClosureRoute(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('You want to see "about" page.', $output);
+ $this->assertStringContainsString('You want to see "about" page.', (string) $output);
}
/**
@@ -144,7 +144,7 @@ public function testRun404Override(): void
$this->codeigniter->run($routes);
$output = ob_get_clean();
- $this->assertStringContainsString("Can't find a route for 'GET: pages/about'.", $output);
+ $this->assertStringContainsString("Can't find a route for 'GET: pages/about'.", (string) $output);
$this->assertSame(404, response()->getStatusCode());
}
@@ -163,7 +163,7 @@ public function testRun404OverrideControllerReturnsResponse(): void
$response = $this->codeigniter->run($routes, true);
$this->assertInstanceOf(ResponseInterface::class, $response);
- $this->assertStringContainsString('Oops', $response->getBody());
+ $this->assertStringContainsString('Oops', (string) $response->getBody());
$this->assertSame(567, $response->getStatusCode());
}
@@ -182,7 +182,7 @@ public function testRun404OverrideReturnResponse(): void
$response = $this->codeigniter->run($routes, true);
$this->assertInstanceOf(ResponseInterface::class, $response);
- $this->assertStringContainsString('Oops', $response->getBody());
+ $this->assertStringContainsString('Oops', (string) $response->getBody());
}
public function testRun404OverrideByClosure(): void
@@ -203,7 +203,7 @@ public function testRun404OverrideByClosure(): void
$this->codeigniter->run($routes);
$output = ob_get_clean();
- $this->assertStringContainsString('404 Override by Closure.', $output);
+ $this->assertStringContainsString('404 Override by Closure.', (string) $output);
$this->assertSame(404, response()->getStatusCode());
}
@@ -228,7 +228,7 @@ public function testControllersCanReturnString(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('You want to see "about" page.', $output);
+ $this->assertStringContainsString('You want to see "about" page.', (string) $output);
}
public function testControllersCanReturnResponseObject(): void
@@ -254,7 +254,7 @@ public function testControllersCanReturnResponseObject(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString("You want to see 'about' page.", $output);
+ $this->assertStringContainsString("You want to see 'about' page.", (string) $output);
}
/**
@@ -308,7 +308,7 @@ public function testRunExecuteFilterByClassName(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('http://hellowworld.com', $output);
+ $this->assertStringContainsString('http://hellowworld.com', (string) $output);
$this->resetServices();
}
@@ -346,7 +346,7 @@ public function testRegisterSameFilterTwiceWithDifferentArgument(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('http://hellowworld.comhttp://hellowworld.com', $output);
+ $this->assertStringContainsString('http://hellowworld.comhttp://hellowworld.com', (string) $output);
$this->resetServices();
}
@@ -374,7 +374,7 @@ public function testDisableControllerFilters(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('', $output);
+ $this->assertStringContainsString('', (string) $output);
$this->resetServices();
}
@@ -402,7 +402,7 @@ public function testRoutesIsEmpty(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('Welcome to CodeIgniter', $output);
+ $this->assertStringContainsString('Welcome to CodeIgniter', (string) $output);
}
public function testTransfersCorrectHTTPVersion(): void
@@ -447,7 +447,7 @@ public function testIgnoringErrorSuppressedByAt(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('Welcome to CodeIgniter', $output);
+ $this->assertStringContainsString('Welcome to CodeIgniter', (string) $output);
}
public function testRunForceSecure(): void
@@ -684,7 +684,7 @@ public function testRunDefaultRoute(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('Welcome to CodeIgniter', $output);
+ $this->assertStringContainsString('Welcome to CodeIgniter', (string) $output);
}
public function testRunCLIRoute(): void
@@ -704,7 +704,7 @@ public function testRunCLIRoute(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('Method Not Allowed', $output);
+ $this->assertStringContainsString('Method Not Allowed', (string) $output);
}
public function testSpoofRequestMethodCanUsePUT(): void
@@ -795,7 +795,7 @@ public function testPageCacheSendSecureHeaders(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('This is a test page', $output);
+ $this->assertStringContainsString('This is a test page', (string) $output);
$response = service('response');
$headers = $response->headers();
$this->assertArrayHasKey('X-Frame-Options', $headers);
@@ -805,7 +805,7 @@ public function testPageCacheSendSecureHeaders(): void
$this->codeigniter->run();
$output = ob_get_clean();
- $this->assertStringContainsString('This is a test page', $output);
+ $this->assertStringContainsString('This is a test page', (string) $output);
$response = service('response');
$headers = $response->headers();
$this->assertArrayHasKey('X-Frame-Options', $headers);
diff --git a/tests/system/Commands/Database/ShowTableInfoTest.php b/tests/system/Commands/Database/ShowTableInfoTest.php
index a707f519a858..a2749c812d8b 100644
--- a/tests/system/Commands/Database/ShowTableInfoTest.php
+++ b/tests/system/Commands/Database/ShowTableInfoTest.php
@@ -116,7 +116,7 @@ public function testDbTableMetadata(): void
$expected = <<<'EOL'
| Field Name | Type | Max Length | Nullable | Default | Primary Key |
EOL;
- $this->assertStringContainsString($expected, $result);
+ $this->assertStringContainsString($expected, (string) $result);
}
public function testDbTableDesc(): void
diff --git a/tests/system/Commands/EnvironmentCommandTest.php b/tests/system/Commands/EnvironmentCommandTest.php
index 8bab8db12cc0..b62ade32c827 100644
--- a/tests/system/Commands/EnvironmentCommandTest.php
+++ b/tests/system/Commands/EnvironmentCommandTest.php
@@ -94,6 +94,6 @@ public function testSettingNewEnvIsSuccess(): void
command('env development');
$this->assertStringContainsString('Environment is successfully changed to', $this->getStreamFilterBuffer());
- $this->assertStringContainsString('CI_ENVIRONMENT = development', file_get_contents($this->envPath));
+ $this->assertStringContainsString('CI_ENVIRONMENT = development', (string) file_get_contents($this->envPath));
}
}
diff --git a/tests/system/Commands/FilterCheckTest.php b/tests/system/Commands/FilterCheckTest.php
index 6bc594ba1831..c6644e02e94e 100644
--- a/tests/system/Commands/FilterCheckTest.php
+++ b/tests/system/Commands/FilterCheckTest.php
@@ -48,14 +48,14 @@ public function testFilterCheckDefinedRoute(): void
$this->assertStringContainsString(
'| GET | / | forcehttps pagecache | pagecache performance toolbar |',
- preg_replace('/\033\[.+?m/u', '', $this->getBuffer()),
+ (string) preg_replace('/\033\[.+?m/u', '', $this->getBuffer()),
);
$this->assertStringContainsString(
'Before Filter Classes:
CodeIgniter\Filters\ForceHTTPS → CodeIgniter\Filters\PageCache
After Filter Classes:
CodeIgniter\Filters\PageCache → CodeIgniter\Filters\PerformanceMetrics → CodeIgniter\Filters\DebugToolbar',
- preg_replace('/\033\[.+?m/u', '', $this->getBuffer()),
+ (string) preg_replace('/\033\[.+?m/u', '', $this->getBuffer()),
);
}
diff --git a/tests/system/Commands/GenerateKeyTest.php b/tests/system/Commands/GenerateKeyTest.php
index 01e2b2c750df..6dd7a7330c36 100644
--- a/tests/system/Commands/GenerateKeyTest.php
+++ b/tests/system/Commands/GenerateKeyTest.php
@@ -92,18 +92,18 @@ public function testGenerateKeyCreatesNewKey(): void
{
command('key:generate');
$this->assertStringContainsString('successfully set.', $this->getBuffer());
- $this->assertStringContainsString(env('encryption.key'), file_get_contents($this->envPath));
- $this->assertStringContainsString('hex2bin:', file_get_contents($this->envPath));
+ $this->assertStringContainsString(env('encryption.key'), (string) file_get_contents($this->envPath));
+ $this->assertStringContainsString('hex2bin:', (string) file_get_contents($this->envPath));
command('key:generate --prefix base64 --force');
$this->assertStringContainsString('successfully set.', $this->getBuffer());
- $this->assertStringContainsString(env('encryption.key'), file_get_contents($this->envPath));
- $this->assertStringContainsString('base64:', file_get_contents($this->envPath));
+ $this->assertStringContainsString(env('encryption.key'), (string) file_get_contents($this->envPath));
+ $this->assertStringContainsString('base64:', (string) file_get_contents($this->envPath));
command('key:generate --prefix hex2bin --force');
$this->assertStringContainsString('successfully set.', $this->getBuffer());
- $this->assertStringContainsString(env('encryption.key'), file_get_contents($this->envPath));
- $this->assertStringContainsString('hex2bin:', file_get_contents($this->envPath));
+ $this->assertStringContainsString(env('encryption.key'), (string) file_get_contents($this->envPath));
+ $this->assertStringContainsString('hex2bin:', (string) file_get_contents($this->envPath));
}
public function testDefaultShippedEnvIsMissing(): void
diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php
index 94455b826826..a28c0cc02e1a 100644
--- a/tests/system/Commands/RoutesTest.php
+++ b/tests/system/Commands/RoutesTest.php
@@ -86,7 +86,7 @@ public function testRoutesCommand(): void
EOL;
$this->assertStringContainsString(
$expected,
- preg_replace('/\033\[.+?m/u', '', $this->getBuffer()),
+ (string) preg_replace('/\033\[.+?m/u', '', $this->getBuffer()),
);
}
diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php
index f87a1f44860c..715ea3051735 100644
--- a/tests/system/CommonFunctionsTest.php
+++ b/tests/system/CommonFunctionsTest.php
@@ -612,7 +612,7 @@ public function testTrace(): void
trace();
$content = ob_get_clean();
- $this->assertStringContainsString('Debug Backtrace', $content);
+ $this->assertStringContainsString('Debug Backtrace', (string) $content);
}
public function testViewNotSaveData(): void
diff --git a/tests/system/Debug/ExceptionHandlerTest.php b/tests/system/Debug/ExceptionHandlerTest.php
index 36279dd58f80..a278ade8be7e 100644
--- a/tests/system/Debug/ExceptionHandlerTest.php
+++ b/tests/system/Debug/ExceptionHandlerTest.php
@@ -135,7 +135,7 @@ public function testHandleWebPageNotFoundExceptionAcceptHTML(): void
$this->handler->handle($exception, $request, $response, 404, EXIT_ERROR);
$output = ob_get_clean();
- $this->assertStringContainsString('
404 - Page Not Found', $output);
+ $this->assertStringContainsString('404 - Page Not Found', (string) $output);
}
public function testHandleCLIPageNotFoundException(): void
diff --git a/tests/system/Filters/HoneypotTest.php b/tests/system/Filters/HoneypotTest.php
index 2d45b35a20b0..7e29177f7d3f 100644
--- a/tests/system/Filters/HoneypotTest.php
+++ b/tests/system/Filters/HoneypotTest.php
@@ -109,7 +109,7 @@ public function testAfter(): void
$this->response->setBody('');
$this->response = $filters->run($uri, 'after');
- $this->assertStringContainsString($this->honey->name, $this->response->getBody());
+ $this->assertStringContainsString($this->honey->name, (string) $this->response->getBody());
}
#[PreserveGlobalState(false)]
@@ -129,6 +129,6 @@ public function testAfterNotApplicable(): void
$this->response->setBody('');
$this->response = $filters->run($uri, 'after');
- $this->assertStringNotContainsString($this->honey->name, $this->response->getBody());
+ $this->assertStringNotContainsString($this->honey->name, (string) $this->response->getBody());
}
}
diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php
index a9657804f489..06dde464a4a4 100644
--- a/tests/system/HTTP/ContentSecurityPolicyTest.php
+++ b/tests/system/HTTP/ContentSecurityPolicyTest.php
@@ -100,12 +100,12 @@ public function testDefaults(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("base-uri 'self';", $result);
- $this->assertStringContainsString("connect-src 'self';", $result);
- $this->assertStringContainsString("default-src 'self';", $result);
- $this->assertStringContainsString("img-src 'self';", $result);
- $this->assertStringContainsString("script-src 'self';", $result);
- $this->assertStringContainsString("style-src 'self';", $result);
+ $this->assertStringContainsString("base-uri 'self';", (string) $result);
+ $this->assertStringContainsString("connect-src 'self';", (string) $result);
+ $this->assertStringContainsString("default-src 'self';", (string) $result);
+ $this->assertStringContainsString("img-src 'self';", (string) $result);
+ $this->assertStringContainsString("script-src 'self';", (string) $result);
+ $this->assertStringContainsString("style-src 'self';", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -118,9 +118,9 @@ public function testChildSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('child-src evil.com;', $result);
+ $this->assertStringContainsString('child-src evil.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("child-src 'self' good.com;", $result);
+ $this->assertStringContainsString("child-src 'self' good.com;", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -134,7 +134,7 @@ public function testConnectSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString("connect-src 'self' iffy.com maybe.com;", $result);
+ $this->assertStringContainsString("connect-src 'self' iffy.com maybe.com;", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -148,9 +148,9 @@ public function testFontSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('font-src iffy.com;', $result);
+ $this->assertStringContainsString('font-src iffy.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('font-src fontsrus.com;', $result);
+ $this->assertStringContainsString('font-src fontsrus.com;', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -163,10 +163,10 @@ public function testFormAction(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString("form-action 'self' surveysrus.com;", $result);
+ $this->assertStringContainsString("form-action 'self' surveysrus.com;", (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringNotContainsString("form-action 'self';", $result);
+ $this->assertStringNotContainsString("form-action 'self';", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -179,9 +179,9 @@ public function testFrameAncestor(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('frame-ancestors them.com;', $result);
+ $this->assertStringContainsString('frame-ancestors them.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("frame-ancestors 'self';", $result);
+ $this->assertStringContainsString("frame-ancestors 'self';", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -194,9 +194,9 @@ public function testFrameSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('frame-src them.com;', $result);
+ $this->assertStringContainsString('frame-src them.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("frame-src 'self';", $result);
+ $this->assertStringContainsString("frame-src 'self';", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -209,9 +209,9 @@ public function testImageSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('img-src them.com;', $result);
+ $this->assertStringContainsString('img-src them.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("img-src 'self' cdn.cloudy.com;", $result);
+ $this->assertStringContainsString("img-src 'self' cdn.cloudy.com;", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -224,9 +224,9 @@ public function testMediaSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('media-src them.com;', $result);
+ $this->assertStringContainsString('media-src them.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("media-src 'self';", $result);
+ $this->assertStringContainsString("media-src 'self';", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -239,9 +239,9 @@ public function testManifestSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('manifest-src them.com;', $result);
+ $this->assertStringContainsString('manifest-src them.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('manifest-src cdn.cloudy.com;', $result);
+ $this->assertStringContainsString('manifest-src cdn.cloudy.com;', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -254,9 +254,9 @@ public function testPluginType(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('plugin-types application/x-shockwave-flash;', $result);
+ $this->assertStringContainsString('plugin-types application/x-shockwave-flash;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("plugin-types 'self';", $result);
+ $this->assertStringContainsString("plugin-types 'self';", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -269,7 +269,7 @@ public function testPluginArray(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('plugin-types application/x-shockwave-flash application/wacky-hacky;', $result);
+ $this->assertStringContainsString('plugin-types application/x-shockwave-flash application/wacky-hacky;', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -282,9 +282,9 @@ public function testObjectSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('object-src them.com;', $result);
+ $this->assertStringContainsString('object-src them.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("object-src 'self' cdn.cloudy.com;", $result);
+ $this->assertStringContainsString("object-src 'self' cdn.cloudy.com;", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -297,9 +297,9 @@ public function testScriptSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('script-src them.com;', $result);
+ $this->assertStringContainsString('script-src them.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("script-src 'self' cdn.cloudy.com;", $result);
+ $this->assertStringContainsString("script-src 'self' cdn.cloudy.com;", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -312,9 +312,9 @@ public function testStyleSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
- $this->assertStringContainsString('style-src them.com;', $result);
+ $this->assertStringContainsString('style-src them.com;', (string) $result);
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("style-src 'self' cdn.cloudy.com;", $result);
+ $this->assertStringContainsString("style-src 'self' cdn.cloudy.com;", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -325,7 +325,7 @@ public function testBaseURIDefault(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("base-uri 'self';", $result);
+ $this->assertStringContainsString("base-uri 'self';", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -337,7 +337,7 @@ public function testBaseURI(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('base-uri example.com;', $result);
+ $this->assertStringContainsString('base-uri example.com;', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -349,7 +349,7 @@ public function testBaseURIRich(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("base-uri 'self' example.com;", $result);
+ $this->assertStringContainsString("base-uri 'self' example.com;", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -363,7 +363,7 @@ public function testDefaultSrc(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('default-src iffy.com;', $result);
+ $this->assertStringContainsString('default-src iffy.com;', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -376,7 +376,7 @@ public function testReportURI(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('report-uri http://example.com/csptracker;', $result);
+ $this->assertStringContainsString('report-uri http://example.com/csptracker;', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -389,7 +389,7 @@ public function testRemoveReportURI(): void
$this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringNotContainsString('report-uri ', $result);
+ $this->assertStringNotContainsString('report-uri ', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -403,7 +403,7 @@ public function testSandboxFlags(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('sandbox allow-popups allow-top-navigation;', $result);
+ $this->assertStringContainsString('sandbox allow-popups allow-top-navigation;', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -415,7 +415,7 @@ public function testUpgradeInsecureRequests(): void
$result = $this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('upgrade-insecure-requests;', $result);
+ $this->assertStringContainsString('upgrade-insecure-requests;', (string) $result);
}
#[PreserveGlobalState(false)]
@@ -444,9 +444,9 @@ public function testBodyScriptNonce(): void
static fn ($value): bool => str_starts_with($value, 'nonce-'),
);
- $this->assertStringContainsString('nonce=', $this->response->getBody());
+ $this->assertStringContainsString('nonce=', (string) $this->response->getBody());
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('nonce-', $result);
+ $this->assertStringContainsString('nonce-', (string) $result);
$this->assertSame([], $nonceStyle);
}
@@ -463,7 +463,7 @@ public function testBodyScriptNonceCustomScriptTag(): void
$csp->finalize($response);
- $this->assertStringContainsString('nonce=', $response->getBody());
+ $this->assertStringContainsString('nonce=', (string) $response->getBody());
}
public function testBodyScriptNonceDisableAutoNonce(): void
@@ -479,7 +479,7 @@ public function testBodyScriptNonceDisableAutoNonce(): void
$csp->finalize($response);
- $this->assertStringContainsString('{csp-script-nonce}', $response->getBody());
+ $this->assertStringContainsString('{csp-script-nonce}', (string) $response->getBody());
$result = new TestResponse($response);
$result->assertHeader('Content-Security-Policy');
@@ -498,7 +498,7 @@ public function testBodyStyleNonceDisableAutoNonce(): void
$csp->finalize($response);
- $this->assertStringContainsString('{csp-style-nonce}', $response->getBody());
+ $this->assertStringContainsString('{csp-style-nonce}', (string) $response->getBody());
$result = new TestResponse($response);
$result->assertHeader('Content-Security-Policy');
@@ -519,9 +519,9 @@ public function testBodyStyleNonce(): void
static fn ($value): bool => str_starts_with($value, 'nonce-'),
);
- $this->assertStringContainsString('nonce=', $this->response->getBody());
+ $this->assertStringContainsString('nonce=', (string) $this->response->getBody());
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString('nonce-', $result);
+ $this->assertStringContainsString('nonce-', (string) $result);
$this->assertSame([], $nonceScript);
}
@@ -538,7 +538,7 @@ public function testBodyStyleNonceCustomStyleTag(): void
$csp->finalize($response);
- $this->assertStringContainsString('nonce=', $response->getBody());
+ $this->assertStringContainsString('nonce=', (string) $response->getBody());
}
#[PreserveGlobalState(false)]
@@ -560,7 +560,7 @@ public function testHeaderIgnoreCase(): void
$result = $this->work();
$result = $this->getHeaderEmitted('content-security-policy', true);
- $this->assertStringContainsString("base-uri 'self';", $result);
+ $this->assertStringContainsString("base-uri 'self';", (string) $result);
}
#[PreserveGlobalState(false)]
@@ -602,7 +602,7 @@ public function testHeaderScriptNonceEmittedOnceGetScriptNonceCalled(): void
$this->work();
$result = $this->getHeaderEmitted('Content-Security-Policy');
- $this->assertStringContainsString("script-src 'self' 'nonce-", $result);
+ $this->assertStringContainsString("script-src 'self' 'nonce-", (string) $result);
}
public function testClearDirective(): void
diff --git a/tests/system/Honeypot/HoneypotTest.php b/tests/system/Honeypot/HoneypotTest.php
index 6fb91c90dd0c..b92c2d1158b7 100644
--- a/tests/system/Honeypot/HoneypotTest.php
+++ b/tests/system/Honeypot/HoneypotTest.php
@@ -63,10 +63,10 @@ public function testAttachHoneypot(): void
$this->response->setBody('');
$this->honeypot->attachHoneypot($this->response);
- $this->assertStringContainsString($this->config->name, $this->response->getBody());
+ $this->assertStringContainsString($this->config->name, (string) $this->response->getBody());
$this->response->setBody('');
- $this->assertStringNotContainsString($this->config->name, $this->response->getBody());
+ $this->assertStringNotContainsString($this->config->name, (string) $this->response->getBody());
}
public function testAttachHoneypotBodyNull(): void
@@ -188,7 +188,7 @@ public function testHoneypotFilterAfter(): void
$this->response->setBody('');
$this->response = $filters->run($uri, 'after');
- $this->assertStringContainsString($this->config->name, $this->response->getBody());
+ $this->assertStringContainsString($this->config->name, (string) $this->response->getBody());
}
public function testEmptyConfigContainer(): void
diff --git a/tests/system/Log/Handlers/FileHandlerTest.php b/tests/system/Log/Handlers/FileHandlerTest.php
index 6647a42c8b43..c810c96f9750 100644
--- a/tests/system/Log/Handlers/FileHandlerTest.php
+++ b/tests/system/Log/Handlers/FileHandlerTest.php
@@ -76,7 +76,7 @@ public function testHandleCreateFile(): void
// did the log file get created?
$expectedResult = 'This is a test log';
- $this->assertStringContainsString($expectedResult, $line);
+ $this->assertStringContainsString($expectedResult, (string) $line);
}
public function testHandleDateTimeCorrectly(): void
@@ -94,6 +94,6 @@ public function testHandleDateTimeCorrectly(): void
fclose($fp);
$expectedResult = 'Test message';
- $this->assertStringContainsString($expectedResult, $line);
+ $this->assertStringContainsString($expectedResult, (string) $line);
}
}
diff --git a/tests/system/Models/PaginateModelTest.php b/tests/system/Models/PaginateModelTest.php
index b7e4661f83ec..43a915bf101e 100644
--- a/tests/system/Models/PaginateModelTest.php
+++ b/tests/system/Models/PaginateModelTest.php
@@ -100,13 +100,13 @@ public function testMultiplePager(): void
$this->assertSame(4, $validModel->countAllResults());
$this->assertSame(4, $userModel->countAllResults());
- $this->assertStringContainsString('?page_valid=1"', $pager->links('valid'));
- $this->assertStringContainsString('?page_valid=2"', $pager->links('valid'));
- $this->assertStringContainsString('?page_valid=3"', $pager->links('valid'));
- $this->assertStringContainsString('?page_valid=4"', $pager->links('valid'));
- $this->assertStringContainsString('?page_user=1"', $pager->links('user'));
- $this->assertStringContainsString('?page_user=2"', $pager->links('user'));
- $this->assertStringContainsString('?page_user=3"', $pager->links('user'));
- $this->assertStringContainsString('?page_user=4"', $pager->links('user'));
+ $this->assertStringContainsString('?page_valid=1"', (string) $pager->links('valid'));
+ $this->assertStringContainsString('?page_valid=2"', (string) $pager->links('valid'));
+ $this->assertStringContainsString('?page_valid=3"', (string) $pager->links('valid'));
+ $this->assertStringContainsString('?page_valid=4"', (string) $pager->links('valid'));
+ $this->assertStringContainsString('?page_user=1"', (string) $pager->links('user'));
+ $this->assertStringContainsString('?page_user=2"', (string) $pager->links('user'));
+ $this->assertStringContainsString('?page_user=3"', (string) $pager->links('user'));
+ $this->assertStringContainsString('?page_user=4"', (string) $pager->links('user'));
}
}
diff --git a/tests/system/Models/ReplaceModelTest.php b/tests/system/Models/ReplaceModelTest.php
index 1fa71323334e..a0a98ab696cd 100644
--- a/tests/system/Models/ReplaceModelTest.php
+++ b/tests/system/Models/ReplaceModelTest.php
@@ -38,11 +38,11 @@ public function testReplaceRespectsUseTimestamps(): void
$data['country'] = 'UK';
$sql = $this->model->replace($data, true);
- $this->assertStringNotContainsString('updated_at', $sql);
+ $this->assertStringNotContainsString('updated_at', (string) $sql);
$this->model = $this->createModel(UserModel::class);
$this->setPrivateProperty($this->model, 'useTimestamps', true);
$sql = $this->model->replace($data, true);
- $this->assertStringContainsString('updated_at', $sql);
+ $this->assertStringContainsString('updated_at', (string) $sql);
}
}
diff --git a/tests/system/Publisher/PublisherContentReplaceTest.php b/tests/system/Publisher/PublisherContentReplaceTest.php
index a30d89e37168..fd948ea70896 100644
--- a/tests/system/Publisher/PublisherContentReplaceTest.php
+++ b/tests/system/Publisher/PublisherContentReplaceTest.php
@@ -54,7 +54,7 @@ public function testAddLineAfter(): void
$this->assertStringContainsString(
' public bool $CSPEnabled = false;
public int $myOwnConfig = 1000;',
- file_get_contents($this->file),
+ (string) file_get_contents($this->file),
);
}
@@ -70,7 +70,7 @@ public function testAddLineBefore(): void
$this->assertStringContainsString(
' public int $myOwnConfig = 1000;
public bool $CSPEnabled = false;',
- file_get_contents($this->file),
+ (string) file_get_contents($this->file),
);
}
@@ -87,15 +87,15 @@ public function testReplace(): void
$this->assertTrue($result);
$this->assertStringNotContainsString(
'use CodeIgniter\Config\BaseConfig;',
- file_get_contents($this->file),
+ (string) file_get_contents($this->file),
);
$this->assertStringContainsString(
'class App extends \Some\Package\SomeConfig',
- file_get_contents($this->file),
+ (string) file_get_contents($this->file),
);
$this->assertStringNotContainsString(
'class App extends BaseConfig',
- file_get_contents($this->file),
+ (string) file_get_contents($this->file),
);
}
}
diff --git a/tests/system/RESTful/ResourceControllerTest.php b/tests/system/RESTful/ResourceControllerTest.php
index b7b16325952b..fcbe08070a81 100644
--- a/tests/system/RESTful/ResourceControllerTest.php
+++ b/tests/system/RESTful/ResourceControllerTest.php
@@ -107,7 +107,7 @@ public function testResourceGet(): void
$output = ob_get_clean();
$error = json_decode($output)->messages->error;
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['index']), $error);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['index']), (string) $error);
}
public function testResourceGetNew(): void
@@ -129,7 +129,7 @@ public function testResourceGetNew(): void
$output = ob_get_clean();
$error = json_decode($output)->messages->error;
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['new']), $error);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['new']), (string) $error);
}
public function testResourceGetEdit(): void
@@ -152,7 +152,7 @@ public function testResourceGetEdit(): void
$output = ob_get_clean();
$error = json_decode($output)->messages->error;
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['edit']), $error);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['edit']), (string) $error);
}
public function testResourceGetOne(): void
@@ -174,7 +174,7 @@ public function testResourceGetOne(): void
$output = ob_get_clean();
$error = json_decode($output)->messages->error;
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['show']), $error);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['show']), (string) $error);
}
public function testResourcePost(): void
@@ -195,7 +195,7 @@ public function testResourcePost(): void
$output = ob_get_clean();
$error = json_decode($output)->messages->error;
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['create']), $error);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['create']), (string) $error);
}
public function testResourcePatch(): void
@@ -217,7 +217,7 @@ public function testResourcePatch(): void
$output = ob_get_clean();
$error = json_decode($output)->messages->error;
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['update']), $error);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['update']), (string) $error);
}
public function testResourcePut(): void
@@ -239,7 +239,7 @@ public function testResourcePut(): void
$output = ob_get_clean();
$error = json_decode($output)->messages->error;
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['update']), $error);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['update']), (string) $error);
}
public function testResourceDelete(): void
@@ -261,7 +261,7 @@ public function testResourceDelete(): void
$output = ob_get_clean();
$error = json_decode($output)->messages->error;
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['delete']), $error);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['delete']), (string) $error);
}
public function testModel(): void
diff --git a/tests/system/RESTful/ResourcePresenterTest.php b/tests/system/RESTful/ResourcePresenterTest.php
index 3617e7a18e67..db10f07f6588 100644
--- a/tests/system/RESTful/ResourcePresenterTest.php
+++ b/tests/system/RESTful/ResourcePresenterTest.php
@@ -119,7 +119,7 @@ public function testResourceShow(): void
$this->codeigniter->run($this->routes);
$output = ob_get_clean();
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['show']), $output);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['show']), (string) $output);
}
public function testResourceNew(): void
@@ -140,7 +140,7 @@ public function testResourceNew(): void
$this->codeigniter->run($this->routes);
$output = ob_get_clean();
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['new']), $output);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['new']), (string) $output);
}
public function testResourceCreate(): void
@@ -161,7 +161,7 @@ public function testResourceCreate(): void
$this->codeigniter->run($this->routes);
$output = ob_get_clean();
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['create']), $output);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['create']), (string) $output);
}
public function testResourceRemove(): void
@@ -183,7 +183,7 @@ public function testResourceRemove(): void
$this->codeigniter->run($this->routes);
$output = ob_get_clean();
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['remove']), $output);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['remove']), (string) $output);
}
public function testResourceDelete(): void
@@ -205,7 +205,7 @@ public function testResourceDelete(): void
$this->codeigniter->run($this->routes);
$output = ob_get_clean();
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['delete']), $output);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['delete']), (string) $output);
}
public function testResourceEdit(): void
@@ -228,7 +228,7 @@ public function testResourceEdit(): void
$this->codeigniter->run($this->routes);
$output = ob_get_clean();
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['edit']), $output);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['edit']), (string) $output);
}
public function testResourceUpdate(): void
@@ -250,7 +250,7 @@ public function testResourceUpdate(): void
$this->codeigniter->run($this->routes);
$output = ob_get_clean();
- $this->assertStringContainsString(lang('RESTful.notImplemented', ['update']), $output);
+ $this->assertStringContainsString(lang('RESTful.notImplemented', ['update']), (string) $output);
}
public function testModel(): void
diff --git a/tests/system/Security/CheckPhpIniTest.php b/tests/system/Security/CheckPhpIniTest.php
index e100079dfa79..c11671728ca5 100644
--- a/tests/system/Security/CheckPhpIniTest.php
+++ b/tests/system/Security/CheckPhpIniTest.php
@@ -71,6 +71,6 @@ public function testRunWeb(): void
{
$output = CheckPhpIni::run(false);
- $this->assertStringContainsString('display_errors', $output);
+ $this->assertStringContainsString('display_errors', (string) $output);
}
}
diff --git a/tests/system/SparkTest.php b/tests/system/SparkTest.php
index 19f5b9934db9..c480196cf410 100644
--- a/tests/system/SparkTest.php
+++ b/tests/system/SparkTest.php
@@ -28,6 +28,6 @@ public function testCanUseOption(): void
passthru('php spark list --simple');
$output = ob_get_clean();
- $this->assertStringContainsString('cache:clear', $output);
+ $this->assertStringContainsString('cache:clear', (string) $output);
}
}