[pLog-svn] r3776 - plog/trunk/class/test/tests/data

Mark Wu markplace at gmail.com
Sun Jul 23 15:51:22 GMT 2006


You can finish this, I will try to write the email-test. :)

Thanks.

Mark 

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> Oscar Renalias
> Sent: Sunday, July 23, 2006 11:47 PM
> To: plog-svn at devel.lifetype.net
> Subject: Re: [pLog-svn] r3776 - plog/trunk/class/test/tests/data
> 
> I figured a few cases myself and their expected output, but 
> please add some more below if needed.
> 
> On 23 Jul 2006, at 18:06, oscar at devel.lifetype.net wrote:
> 
> > 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
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
> 
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn



More information about the pLog-svn mailing list