@@ -535,4 +535,66 @@ public function testMatchCaseSensitive(): void
535535 Assert::false ($ result , 'On Unix, match should be case-sensitive ' );
536536 }
537537 }
538+
539+ public function testMatchWithCaseSensitiveFlag (): void
540+ {
541+ // Arrange
542+ $ path = Path::create ('Test/File.TXT ' )->absolute ();
543+ $ pattern = 'test/file.txt ' ;
544+
545+ // Act & Assert - case-sensitive matching
546+ Assert::false ($ path ->match ($ pattern , true ), 'Should not match when case-sensitive is true ' );
547+
548+ // Act & Assert - case-insensitive matching
549+ Assert::true ($ path ->match ($ pattern , false ), 'Should match when case-sensitive is false ' );
550+ }
551+
552+ public function testMatchWithCaseSensitiveFlagExactCase (): void
553+ {
554+ // Arrange
555+ $ path = Path::create ('Test/File.TXT ' )->absolute ();
556+ $ patternExact = 'Test/File.TXT ' ;
557+ $ patternLower = 'test/file.txt ' ;
558+
559+ // Act & Assert - exact case with case-sensitive flag
560+ Assert::true ($ path ->match ($ patternExact , true ), 'Should match exact case with case-sensitive flag ' );
561+
562+ // Act & Assert - different case with case-sensitive flag
563+ Assert::false ($ path ->match ($ patternLower , true ), 'Should not match different case with case-sensitive flag ' );
564+ }
565+
566+ public function testMatchCaseInsensitiveOnAllOS (): void
567+ {
568+ // Arrange
569+ $ path = Path::create ('Documents/FILE.txt ' )->absolute ();
570+
571+ // Act & Assert - force case-insensitive on any OS
572+ Assert::true ($ path ->match ('*/file.TXT ' , false ), 'Should match with case-insensitive flag ' );
573+ Assert::true ($ path ->match ('*/FILE.txt ' , false ), 'Should match with case-insensitive flag ' );
574+ Assert::true ($ path ->match ('*/FiLe.TxT ' , false ), 'Should match with case-insensitive flag ' );
575+ }
576+
577+ public function testMatchCaseSensitiveOnAllOS (): void
578+ {
579+ // Arrange
580+ $ path = Path::create ('Documents/report.PDF ' )->absolute ();
581+
582+ // Act & Assert - force case-sensitive on any OS
583+ Assert::true ($ path ->match ('*/report.PDF ' , true ), 'Should match exact case ' );
584+ Assert::false ($ path ->match ('*/report.pdf ' , true ), 'Should not match different case ' );
585+ Assert::false ($ path ->match ('*/REPORT.PDF ' , true ), 'Should not match different case ' );
586+ }
587+
588+ public function testMatchWithWildcardsAndCaseFlag (): void
589+ {
590+ // Arrange
591+ $ path = Path::create ('src/Controller/UserController.php ' )->absolute ();
592+
593+ // Act & Assert - wildcards with case-insensitive
594+ Assert::true ($ path ->match ('*/controller/*.PHP ' , false ), 'Wildcard should match case-insensitive ' );
595+
596+ // Act & Assert - wildcards with case-sensitive
597+ Assert::false ($ path ->match ('*/controller/*.php ' , true ), 'Should not match - Controller != controller ' );
598+ Assert::true ($ path ->match ('*/Controller/*.php ' , true ), 'Should match with correct case ' );
599+ }
538600}
0 commit comments