diff --git a/tests/Support/SupportStrTest.php b/tests/Support/SupportStrTest.php index 74469575bc05..4183d608ef78 100755 --- a/tests/Support/SupportStrTest.php +++ b/tests/Support/SupportStrTest.php @@ -302,6 +302,29 @@ public function testStrContainsAll($haystack, $needles, $expected, $ignoreCase = $this->assertEquals($expected, Str::containsAll($haystack, $needles, $ignoreCase)); } + public function testConvertCase() + { + // Test Upper Case Conversion + $this->assertSame('HELLO', Str::convertCase('hello', MB_CASE_UPPER)); + $this->assertSame('WORLD', Str::convertCase('WORLD', MB_CASE_UPPER)); + + // Test Lower Case Conversion + $this->assertSame('hello', Str::convertCase('HELLO', MB_CASE_LOWER)); + $this->assertSame('world', Str::convertCase('WORLD', MB_CASE_LOWER)); + + // Test Case Folding + $this->assertSame('hello', Str::convertCase('HeLLo', MB_CASE_FOLD)); + $this->assertSame('world', Str::convertCase('WoRLD', MB_CASE_FOLD)); + + // Test Multi-byte String + $this->assertSame('ÜÖÄ', Str::convertCase('üöä', MB_CASE_UPPER, 'UTF-8')); + $this->assertSame('üöä', Str::convertCase('ÜÖÄ', MB_CASE_LOWER, 'UTF-8')); + + // Test Unsupported Mode (Let's assume '-1' is unsupported) + $this->assertSame('Hello', Str::convertCase('Hello', -1)); + } + + public function testParseCallback() { $this->assertEquals(['Class', 'method'], Str::parseCallback('Class@method', 'foo'));