[pLog-svn] r3776 - plog/trunk/class/test/tests/data
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Sun Jul 23 15:06:16 GMT 2006
Author: oscar
Date: 2006-07-23 15:06:15 +0000 (Sun, 23 Jul 2006)
New Revision: 3776
Added:
plog/trunk/class/test/tests/data/textfilter_test.class.php
Log:
some basic test cases for the Textfilter::slugify() method
Added: plog/trunk/class/test/tests/data/textfilter_test.class.php
===================================================================
--- plog/trunk/class/test/tests/data/textfilter_test.class.php 2006-07-23 08:25:14 UTC (rev 3775)
+++ plog/trunk/class/test/tests/data/textfilter_test.class.php 2006-07-23 15:06:15 UTC (rev 3776)
@@ -0,0 +1,44 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+ include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
+
+ /**
+ * \ingroup Tests
+ *
+ * Test cases for the Textfilter class
+ */
+ class Textfilter_Test extends LifeTypeTestCase
+ {
+ function setup()
+ {
+ $this->tf = new Textfilter();
+ }
+
+ /**
+ * Verifies the 'slugify' method
+ */
+ function testSlugify()
+ {
+ // load the value of the default separator
+ $config =& Config::getConfig();
+ $sep = $config->getValue( "urlize_word_separator", URLIZE_WORD_SEPARATOR_DEFAULT );
+
+ $tests = Array( // associative array where the key is the input and the value is the expected output
+ "simple" => "simple",
+ "two words" => "two{$sep}words",
+ "two spaces" => "two{$sep}spaces",
+ " leadingblanks" => "leadingblanks",
+ "trailingblanks " => "trailingblanks",
+ "<a>html</a><b>is</b><h1>not</h1><p>allowed</p>" => "a{$sep}html{$sep}a{$sep}b{$sep}is{$sep}b{$sep}h1{$sep}not{$sep}h1{$sep}p{$sep}allowed{$sep}p"
+ );
+
+ // process each one of them
+ foreach( $tests as $input => $output ) {
+ $result = $this->tf->slugify( $input );
+ $this->assertEquals( $output, $result );
+ }
+ }
+ }
+?>
\ No newline at end of file
More information about the pLog-svn
mailing list