[pLog-svn] r5086 - plog/branches/lifetype-1.2/class/test/tests/data
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Tue Mar 13 17:23:19 EDT 2007
Author: oscar
Date: 2007-03-13 17:23:19 -0400 (Tue, 13 Mar 2007)
New Revision: 5086
Modified:
plog/branches/lifetype-1.2/class/test/tests/data/textfilter_test.class.php
Log:
Adjusted the test cases for the Textfilter::Domainize() function and added a test case for the Textfilter::htmlDecode() method, hopefully it will help us understand and fix the issue quicker.
Modified: plog/branches/lifetype-1.2/class/test/tests/data/textfilter_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/data/textfilter_test.class.php 2007-03-13 20:36:55 UTC (rev 5085)
+++ plog/branches/lifetype-1.2/class/test/tests/data/textfilter_test.class.php 2007-03-13 21:23:19 UTC (rev 5086)
@@ -59,10 +59,10 @@
"test blog" => "test{$sep}blog",
"test-blog" => "test{$sep}blog",
"test_blog" => "test{$sep}blog",
- "test.blog" => "test{$sep}blog",
+ "test.blog" => "test.blog",
"??test//blog" => "testblog",
"==================test blog" => "test{$sep}blog",
- "this.has.dots_and-hyphens----and spaces " => "this{$sep}has{$sep}dots{$sep}and{$sep}hyphens{$sep}{$sep}{$sep}{$sep}and{$sep}spaces{$sep}"
+ "this.has.dots_and-hyphens----and spaces " => "this.has.dots{$sep}and{$sep}hyphens{$sep}{$sep}{$sep}{$sep}and{$sep}spaces"
);
foreach( $tests as $input => $output ) {
@@ -70,5 +70,27 @@
$this->assertEquals( $output, $result, "input was: $input" );
}
}
+
+ /**
+ * tests the htmlDecode() method
+ */
+ function testHtmlDecode()
+ {
+ // array with strings and the expected result, the key is the
+ // input and the value is the expected output, add more if needed
+ $tests = Array(
+ "&" => "&",
+ "test" => "test",
+ "áé" => "áé",
+ "äÜ" => "äÜ"
+ );
+
+ foreach( $tests as $input => $output ) {
+ // check that the input is equal to the output after processing it with TextFilter::htmlDecode
+ $this->assertEquals( $output, TextFilter::htmlDecode( $input ), "Error htmlDecode()-ing string: $input" );
+ // and that htmlDecode and filterHTMLEntities are really the opposite of each other
+ $this->assertEquals( $output, Textfilter::htmlDecode( TextFilter::filterHTMLEntities( $output )));
+ }
+ }
}
?>
\ No newline at end of file
More information about the pLog-svn
mailing list