[pLog-svn] r3852 - plog/trunk/class/test/tests/dao

oscar at devel.lifetype.net oscar at devel.lifetype.net
Wed Aug 9 18:17:26 GMT 2006


Author: oscar
Date: 2006-08-09 18:17:26 +0000 (Wed, 09 Aug 2006)
New Revision: 3852

Modified:
   plog/trunk/class/test/tests/dao/blogs_test.class.php
Log:
added a case that isn't working yet, the problem being that updating the blog settings via class/action/admin/adminupdateblogsettingsaction.class.php, the uniqueness of the mangled_blog field is lost.


Modified: plog/trunk/class/test/tests/dao/blogs_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/blogs_test.class.php	2006-08-09 18:10:32 UTC (rev 3851)
+++ plog/trunk/class/test/tests/dao/blogs_test.class.php	2006-08-09 18:17:26 UTC (rev 3852)
@@ -42,5 +42,53 @@
 			$blogs->deleteBlog( $blog2->getId());
 			$blogs->deleteBlog( $blog3->getId());
 		}
+		
+		/** 
+		 * regression test for Mantis 1005 (http://bugs.lifetype.net/view.php?id=1005)
+		 * Blog names ("mangled names") should be kept unique accross blog updates!
+		 */
+		function testUpdateBlogUniqueMangledBlog()
+		{
+			$blogs = new Blogs();
+			
+			// create two blogs, both with the same name. The mangled_blog field should be 'xxx' for the first
+			// one that was added and 'xxx2' for the second one. If not, throw an error.
+			
+			// an absolutely random name
+			$randomName = md5(time());
+			
+			// add the blogs
+			$blog1 = new BlogInfo( $randomName, 1, "About blog 1", new BlogSettings());
+			$blog2 = new BlogInfo( $randomName, 1, "About blog 2", new BlogSettings());
+			$blog3 = new BlogInfo( $randomName, 1, "About blog 3", new BlogSettings());			
+			$blogs->addBlog( $blog1 );
+			$blogs->addBlog( $blog2 );
+			$blogs->addBlog( $blog3 );
+			
+			// update the name and the mangled blog name, in the same way it is done in
+			// class/action/admin/adminupdateblogsettingsaction.class.php
+			$blog1->setBlog( $randomName );
+			$blog1->setMangledBlogName( $randomName );
+			$blogs->updateBlog( $blog1 );
+			$blog2->setMangledBlogName( $randomName );			
+			$blog2->setBlog( $randomName );
+			$blog2->setMangledBlogName( $randomName );			
+			$blogs->updateBlog( $blog2 );
+			$blog3->setMangledBlogName( $randomName );			
+			$blog3->setBlog( $randomName );	
+			$blogs->updateBlog( $blog3 );
+			
+			// compare the mangled names
+			$this->assertEquals( $randomName, $blog1->getMangledBlogName());
+			$this->assertEquals( $randomName."2", $blog2->getMangledBlogName());
+			$this->assertEquals( $randomName."3", $blog3->getMangledBlogName());		
+			
+			// delete the temporary blogs
+			$blogs->deleteBlog( $blog1->getId());
+			$blogs->deleteBlog( $blog2->getId());
+			$blogs->deleteBlog( $blog3->getId());
+		}
+
+		
 	}
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list