[pLog-svn] r3756 - in plog/trunk/class: dao test/tests/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Jul 20 06:07:13 GMT 2006
Author: oscar
Date: 2006-07-20 06:07:13 +0000 (Thu, 20 Jul 2006)
New Revision: 3756
Added:
plog/trunk/class/test/tests/dao/article_test.class.php
Modified:
plog/trunk/class/dao/article.class.php
Log:
fix and test case for mantis case 986 http://bugs.lifetype.net/view.php?id=986
Modified: plog/trunk/class/dao/article.class.php
===================================================================
--- plog/trunk/class/dao/article.class.php 2006-07-20 05:55:15 UTC (rev 3755)
+++ plog/trunk/class/dao/article.class.php 2006-07-20 06:07:13 UTC (rev 3756)
@@ -208,7 +208,8 @@
{
$extendedText = trim($this->getExtendedText());
if($extendedText == "<br />" || $extendedText == "<br/>" ||
- $extendedText == "<p/>" || $extendedText == "<p />")
+ $extendedText == "<p/>" || $extendedText == "<p />" ||
+ $extendedText == "" )
return false;
else
return( strlen($this->getExtendedText()) > 0 );
Added: plog/trunk/class/test/tests/dao/article_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/article_test.class.php 2006-07-20 05:55:15 UTC (rev 3755)
+++ plog/trunk/class/test/tests/dao/article_test.class.php 2006-07-20 06:07:13 UTC (rev 3756)
@@ -0,0 +1,49 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/article.class.php" );
+
+ /**
+ * \ingroup Tests
+ *
+ * Test cases for the Article class
+ */
+ class Article_Test extends LifeTypeTestCase
+ {
+ function setUp()
+ {
+ // build a dummy Article object
+ $this->article = new Article(
+ "dummy topic",
+ "dummy text",
+ Array( 1 ), // a dummy category
+ Array( 1 ), // a dummy user
+ POST_STATUS_PUBLISHED, // published status
+ 0 // not read yet
+ );
+ }
+
+ /**
+ * regression test for mantis case 986 (http://bugs.lifetype.net/view.php?id=986)
+ * and for method Article::hasExtendedText in general
+ */
+ function testHasExtendedText()
+ {
+ // set some normal extended text, it should return true
+ $this->article->setExtendedText( "this is a test" );
+ $this->assertTrue( $this->article->hasExtendedText(), "Extended text was set but hasExtendedText returned false!" );
+
+ // remove the text and try again
+ $this->article->setExtendedText( "" );
+ $this->assertFalse( $this->article->hasExtendedText(), "there is no text set but hasExtendedText did not return false!" );
+
+ // set some text that should work as empty
+ foreach( Array( "<br/>", "<br />", "<p/>", "<p />", "" ) as $emptyText ) {
+ $this->article->setExtendedText( $emptyText );
+ $this->assertFalse( $this->article->hasExtendedText(),
+ "extended text set to ".htmlspecialchars($emptyText).", which should count as no extended text ".
+ "but hasExtendedText did not return false!" );
+ }
+ }
+ }
+?>
\ No newline at end of file
More information about the pLog-svn
mailing list