[pLog-svn] r5807 - plog/trunk/class/test/tests/data/filter
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Wed Aug 8 16:34:26 EDT 2007
Author: oscar
Date: 2007-08-08 16:34:26 -0400 (Wed, 08 Aug 2007)
New Revision: 5807
Added:
plog/trunk/class/test/tests/data/filter/regexpfilter_test.class.php
Log:
Unit test for the previous check-in.
Added: plog/trunk/class/test/tests/data/filter/regexpfilter_test.class.php
===================================================================
--- plog/trunk/class/test/tests/data/filter/regexpfilter_test.class.php (rev 0)
+++ plog/trunk/class/test/tests/data/filter/regexpfilter_test.class.php 2007-08-08 20:34:26 UTC (rev 5807)
@@ -0,0 +1,29 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/filter/regexpfilter.class.php" );
+
+ /**
+ * \ingroup Test
+ *
+ * Test case for the RegexpFilter class
+ */
+ class RegexpFilter_Test extends LifeTypeTestCase
+ {
+ function testFilter()
+ {
+ $data = Array(
+ "[^a-zA-Z0-9]" => Array( "abcd" => "abcd", "../whatever/file.name.txt" => "whateverfilenametxt" ),
+ "[^a-z]" => Array( "abcd" => "abcd", "ABCd" => "d" ),
+ "[\.\/]" => Array( "/abcd.abcd" => "abcdabcd" )
+ );
+
+ foreach( $data as $regexp => $results ) {
+ $v = new RegexpFilter( $regexp );
+ foreach( $results as $input => $expectedOutput ) {
+ $this->assertEquals( $expectedOutput, $v->filter( $input ), "Error in filter $regexp: input = $input - expected output = $expectedOutput" );
+ }
+ }
+ }
+ }
+?>
\ No newline at end of file
More information about the pLog-svn
mailing list