[pLog-svn] r3727 - in plog/trunk/class/test/tests: . config dao

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Jul 16 19:54:21 GMT 2006


Author: oscar
Date: 2006-07-16 19:54:20 +0000 (Sun, 16 Jul 2006)
New Revision: 3727

Added:
   plog/trunk/class/test/tests/config/
   plog/trunk/class/test/tests/config/configdbstorage_test.class.php
   plog/trunk/class/test/tests/dao/
   plog/trunk/class/test/tests/dao/bloginfo_test.class.php
Log:
added two more test cases for regression, for svn revision 3762 and mantis issue 978.


Added: plog/trunk/class/test/tests/config/configdbstorage_test.class.php
===================================================================
--- plog/trunk/class/test/tests/config/configdbstorage_test.class.php	2006-07-16 10:03:02 UTC (rev 3726)
+++ plog/trunk/class/test/tests/config/configdbstorage_test.class.php	2006-07-16 19:54:20 UTC (rev 3727)
@@ -0,0 +1,30 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+	include_once( PLOG_CLASS_PATH."class/config/configdbstorage.class.php" );		
+
+	/**
+	 * \ingroup Tests
+	 *
+	 * Test cases for the Config class, but only the database-based backend, not the file backend
+	 */
+	class ConfigDbStorage_Test extends LifeTypeTestCase
+	{
+		/** 
+		 * regression test for svn revision 3726. It basically tests whether the ConfigDbStorage::getValue()
+		 * method will return the default value specified as the second parameter when the provided
+		 * key doesn't exist.
+		 */
+		function testGetValueWithDefaultValue()
+		{
+			$config = new ConfigDbStorage();
+			
+			// request a bogus key and see if we get the default value
+			$defaultValue = "333";
+			$value = $config->getValue( "this_key_should_really_really_not_exist", $defaultValue );
+			
+			// check if they're equal (they should!)
+			$this->assertEquals( $defaultValue, $value, "getValue() did not return the default value when a non-existant key was requested, please see svn revision 3726" );
+		}
+	}
+?>
\ No newline at end of file

Added: plog/trunk/class/test/tests/dao/bloginfo_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/bloginfo_test.class.php	2006-07-16 10:03:02 UTC (rev 3726)
+++ plog/trunk/class/test/tests/dao/bloginfo_test.class.php	2006-07-16 19:54:20 UTC (rev 3727)
@@ -0,0 +1,35 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+	include_once( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );
+	include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );	
+	include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );		
+
+	/**
+	 * \ingroup Tests
+	 *
+	 * Test cases for the BlogInfo class
+	 */
+	class BlogInfo_Test extends LifeTypeTestCase
+	{
+		/** 
+		 * regression test for mantis case 978 (http://bugs.lifetype.net/view.php?id=978)
+		 */
+		function testGetUpdateDateObject()
+		{
+			$blogs = new Blogs();
+			// let's hope that blog '1' exists... if not throw an assert error
+			$blog = $blogs->getBlogInfo( 1 );
+			$this->assertTrue( $blog, "Couldn't load blog with id '1', make sure it exists!" );
+			
+			// test the getUpdateDateObject() method to make sure it does not return the current date
+			$now = new Timestamp();
+			$blogUpdateDate = $blog->getUpdateDateObject();
+			
+			// check that the dates are different
+			$sameDate = ( $now->getIsoDate() == $blogUpdateDate->getIsoDate());
+			
+			$this->assertFalse( $sameDate, "Please see Mantis case 978 <a href='http://bugs.lifetype.net/view.php?id=978'>here</a>." );
+		}
+	}
+?>
\ No newline at end of file



More information about the pLog-svn mailing list