From 0a054866939ce426690997d5918e1ab74b92830f Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Fri, 30 Dec 2022 16:51:14 +0900 Subject: [PATCH] fix: Change assertTextContains()/assertTextNotContains() to match changes in PHPUnit API --- lib/Cake/TestSuite/CakeTestCase.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index 0672d350d..ecebda41a 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -296,7 +296,10 @@ abstract class CakeTestCase extends \PHPUnit\Framework\TestCase { public function assertTextContains($needle, $haystack, $message = '', $ignoreCase = false) { $needle = str_replace(array("\r\n", "\r"), "\n", $needle); $haystack = str_replace(array("\r\n", "\r"), "\n", $haystack); - return $this->assertContains($needle, $haystack, $message, $ignoreCase); + if ($ignoreCase) { + return $this->assertStringContainsStringIgnoringCase($needle, $haystack, $message); + } + return $this->assertStringContainsString($needle, $haystack, $message); } /** @@ -312,7 +315,10 @@ abstract class CakeTestCase extends \PHPUnit\Framework\TestCase { public function assertTextNotContains($needle, $haystack, $message = '', $ignoreCase = false) { $needle = str_replace(array("\r\n", "\r"), "\n", $needle); $haystack = str_replace(array("\r\n", "\r"), "\n", $haystack); - return $this->assertNotContains($needle, $haystack, $message, $ignoreCase); + if ($ignoreCase) { + return $this->assertStringNotContainsStringIgnoringCase($needle, $haystack, $message); + } + return $this->assertStringNotContainsString($needle, $haystack, $message); } /**