[pLog-svn] r4465 - plog/branches/lifetype-1.1.4/class/test/tests/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Mon Jan 1 18:45:40 GMT 2007
Author: oscar
Date: 2007-01-01 18:45:40 +0000 (Mon, 01 Jan 2007)
New Revision: 4465
Modified:
plog/branches/lifetype-1.1.4/class/test/tests/dao/commentscommon_test.class.php
Log:
Test case for mantis issue http://bugs.lifetype.net/view.php?id=1144, but no fix yet.
Modified: plog/branches/lifetype-1.1.4/class/test/tests/dao/commentscommon_test.class.php
===================================================================
--- plog/branches/lifetype-1.1.4/class/test/tests/dao/commentscommon_test.class.php 2007-01-01 18:44:59 UTC (rev 4464)
+++ plog/branches/lifetype-1.1.4/class/test/tests/dao/commentscommon_test.class.php 2007-01-01 18:45:40 UTC (rev 4465)
@@ -1,6 +1,7 @@
<?php
include_once( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+ include_once( PLOG_CLASS_PATH."class/test/helpers/testtools.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/dao/article.class.php" );
@@ -25,19 +26,19 @@
function testGetNumPostComments()
{
- // create a user
+ // create a user
$users = new Users();
$randomName = md5(time());
$user = new UserInfo($randomName, "blah", "test at not-a-real-address.net", "", "Full Name");
$this->assertTrue($users->addUser($user), "Couldn't add test user");
- // create a blog
+ // create a blog
$blogs = new Blogs();
$randomName = md5(time());
$blog = new BlogInfo( $randomName, $user->getId(), "About blog random blog", new BlogSettings());
$this->assertTrue($blogs->addBlog( $blog ), "Couldn't add test blog");
- // add an article
+ // add an article
$articles = new Articles();
$article = new Article(
"dummy topic",
@@ -50,7 +51,7 @@
);
$this->assertTrue($articles->addArticle($article), "Couldn't add test article");
- // Add comments
+ // Add comments
$timestamp = new Timestamp();
$comment1 = new UserComment($article->getId(),
$article->getBlogId(),
@@ -163,6 +164,43 @@
$users->deleteUser($user->getId());
}
+ /**
+ * Test case for mantis bug http://bugs.lifetype.net/view.php?id=1144
+ *
+ * Dates with time offset being saved to the database
+ */
+ function testUpdateCommentWithTimeOffsets()
+ {
+ // create the scenario
+ $user = TestTools::createUser();
+ $blog = TestTools::createBlog( $user->getId());
+ $cat = TestTools::createArticleCategory( $blog->getId());
+ $article = TestTools::createArticle( $blog->getId(), $user->getId(), Array( $cat->getId()));
+
+ // update the time offset settings for the blog
+ $blog->setValue( "time_offset", "+3" );
+ $blogs = new Blogs();
+ $blogs->updateBlog( $blog );
+
+ // create the comment and save it to the database
+ $comment = new UserComment( $article->getId(), $blog->getId(), 0, "test comment", "test comment body" );
+ $comments = new ArticleComments();
+ $comments->addComment( $comment );
+
+ // now get the time
+ $origTime = $comment->getTimestamp();
+
+ // update the comment and reload the comment
+ $comments->updateComment( $comment );
+ $comment2 = $comments->getComment( $comment->getId());
+ $newTime = $comment2->getTimestamp();
+
+ // check that dates are the same
+ $this->assertEquals( $origTime->getTimestamp(), $newTime->getTimestamp(), "Comment times are not the same!" );
+
+ // destroy the test data
+ TestTools::deleteDaoTestData( Array( $user, $blog, $cat, $article, $comment, $comment2 ));
+ }
}
?>
More information about the pLog-svn
mailing list