77use PHPUnit \Framework \Attributes \CoversClass ;
88use PHPUnit \Framework \Attributes \DataProvider ;
99use PHPUnit \Framework \TestCase ;
10- use SimpleSAML \Assert \AssertionFailedException ;
1110use SimpleSAML \XML \Assert \Assert ;
11+ use SimpleSAML \XMLSchema \Exception \SchemaViolationException ;
12+
13+ use function chr ;
1214
1315/**
1416 * Class \SimpleSAML\Test\XML\Assert\StringTest
@@ -28,7 +30,7 @@ public function testString(bool $shouldPass, string $str): void
2830 try {
2931 Assert::validString ($ str );
3032 $ this ->assertTrue ($ shouldPass );
31- } catch (AssertionFailedException $ e ) {
33+ } catch (SchemaViolationException $ e ) {
3234 $ this ->assertFalse ($ shouldPass );
3335 }
3436 }
@@ -42,6 +44,9 @@ public static function provideString(): array
4244 return [
4345 'preserve spaces ' => [true , ' Snoopy ' ],
4446 'replace whitespace ' => [true , " Snoopy \t\n\rrulez " ],
47+ 'html ' => [true , "<em>SimpleSAMLphp</em> " ],
48+ 'unicode ' => [true , 'ünïcöde €Φ汉 ' ],
49+ 'invalid character ' => [false , "Valid text with " . chr (0 ) . " invalid null byte " ],
4550 ];
4651 }
4752}
0 commit comments