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

Oscar Renalias oscar at renalias.net
Mon Jul 24 10:45:36 GMT 2006


I couldn't figure out the output, so I ran the test with this input,
got the output, and placed it as the expected out. It did pass and
that's why I thought it was the "correct" output:

http://devel.lifetype.net/runtests.php?suite=textfilter

On 7/24/06, Jon Daley <plogworld at jon.limedaley.com> wrote:
>         Did you run this test?   I don't think your last test case should
> pass, as I strip out the html first, so it should really just be:
> "<a>html</a><b>is</b><h1>not</h1><p>allowed</p>" =>
> "htmlisnotallowed"
>
> arguably, it should put separators when taking out the html, although
> there are some cases when that might not be what you want.
>
> I see the behavior how I thought it should be on the edit post page.
> Does your test case validate?
>
>
> On Sun, 23 Jul 2006, 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
> >
>
> --
> Jon Daley
> http://jon.limedaley.com/
>
> The ultimate measure of a man is not where he stands in
> moments of comfort, but where he stands at times of challenge.
> -- Martin Luther King, Jr.
> _______________________________________________
> 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