From 183851b06bd6c52f3cae5375f433da720d410447 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 18:12:39 +0000 Subject: MediaWiki 1.7.1 wiederhergestellt --- tests/SanitizerTest.php | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/SanitizerTest.php (limited to 'tests/SanitizerTest.php') diff --git a/tests/SanitizerTest.php b/tests/SanitizerTest.php new file mode 100644 index 00000000..5babf0ae --- /dev/null +++ b/tests/SanitizerTest.php @@ -0,0 +1,65 @@ +PHPUnit_TestCase( $name ); + } + + function setUp() { + } + + function tearDown() { + } + + function testDecodeNamed() { + $this->assertEquals( + "\xc3\xa9cole", + Sanitizer::decodeCharReferences( 'école' ) ); + } + + function testDecodeNumbered() { + $this->assertEquals( + "\xc4\x88io bonas dans l'\xc3\xa9cole!", + Sanitizer::decodeCharReferences( "Ĉio bonas dans l'école!" ) ); + } + + function testDecodeMixed() { + $this->assertEquals( + "\xc4\x88io bonas dans l'\xc3\xa9cole!", + Sanitizer::decodeCharReferences( "Ĉio bonas dans l'école!" ) ); + } + + function testDecodeMixedComplex() { + $this->assertEquals( + "\xc4\x88io bonas dans l'\xc3\xa9cole! (mais pas Ĉio dans l'école)", + Sanitizer::decodeCharReferences( "Ĉio bonas dans l'école! (mais pas Ĉio dans l'école)" ) ); + } + + function testDecodeInvalidAmp() { + $this->assertEquals( + "a & b", + Sanitizer::decodeCharReferences( "a & b" ) ); + } + + function testDecodeInvalidNamed() { + $this->assertEquals( + "&foo;", + Sanitizer::decodeCharReferences( "&foo;" ) ); + } + + function testDecodeInvalidNumbered() { + $this->assertEquals( + UTF8_REPLACEMENT, + Sanitizer::decodeCharReferences( "�" ) ); + } + + /* TODO: many more! */ +} + +?> \ No newline at end of file -- cgit v1.2.2