[pLog-svn] r6675 - in plog/branches/lifetype-1.2/class/test/tests: dao summary/dao
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Mon Jun 23 18:57:39 EDT 2008
Author: jondaley
Date: 2008-06-23 18:57:38 -0400 (Mon, 23 Jun 2008)
New Revision: 6675
Modified:
plog/branches/lifetype-1.2/class/test/tests/dao/commentscommon_test.class.php
plog/branches/lifetype-1.2/class/test/tests/summary/dao/summarystats_test.class.php
Log:
better cleanup
Modified: plog/branches/lifetype-1.2/class/test/tests/dao/commentscommon_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/dao/commentscommon_test.class.php 2008-06-23 22:41:02 UTC (rev 6674)
+++ plog/branches/lifetype-1.2/class/test/tests/dao/commentscommon_test.class.php 2008-06-23 22:57:38 UTC (rev 6675)
@@ -159,7 +159,8 @@
$this->assertTrue($num == 3, "Wrong number of trackbacks (spam) ". $num);
- // delete the temporary blogs
+ // delete the temporary data
+ $articles->deleteBlogPosts($blog->getId());
$blogs->deleteBlog($blog->getId());
$users->deleteUser($user->getId());
}
Modified: plog/branches/lifetype-1.2/class/test/tests/summary/dao/summarystats_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/summary/dao/summarystats_test.class.php 2008-06-23 22:41:02 UTC (rev 6674)
+++ plog/branches/lifetype-1.2/class/test/tests/summary/dao/summarystats_test.class.php 2008-06-23 22:57:38 UTC (rev 6675)
@@ -1,15 +1,8 @@
<?php
lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/article.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/articlecategory.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/test/helpers/testtools.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/userstatus.class.php" );
lt_include( PLOG_CLASS_PATH."class/summary/dao/summarystats.class.php" );
/**
@@ -17,73 +10,21 @@
*/
class SummaryStats_Test extends LifeTypeTestCase
{
- /**
- * dummy blog we'll be using during the tests
- */
var $blog;
-
- /**
- * dummy blog owner
- */
- var $owner;
-
- /**
- * dummy category
- */
+ var $user;
var $cat;
- /**
- * URL pointing to this server's xmlrpc.php
- */
-
function setUp()
{
- // create the blog owner
- $this->owner = new UserInfo( md5(time()), // name
- "password", // password
- "whatever at whatever.com", // email address
- "", // about
- "" );
- $users = new Users();
- if( !$users->addUser( $this->owner )) {
- throw( new Exception( "Error adding test user" ));
- die();
- }
-
- // create the test blog
- $blogs = new Blogs();
- $this->blog = null;
- $this->blog = new BlogInfo( "test blog",
- $this->owner->getId(),
- "",
- new BlogSettings());
- if( !$blogs->addBlog( $this->blog )) {
- throw( new Exception( "Error adding test blog!" ));
- die();
- }
-
- // add a default category
- $this->cat = new ArticleCategory( "General",
- "",
- $this->blog->getId(),
- true );
- $cats = new ArticleCategories();
- if( !$cats->addArticleCategory( $this->cat )) {
- throw( new Exception( "Error adding test category!" ));
- die();
- }
+ $this->user = TestTools::createUser();
+ $this->blog = TestTools::createBlog( $this->user->getId());
+ $this->cat = TestTools::createArticleCategory( $this->blog->getId());
}
function tearDown()
{
- $cats = new ArticleCategories();
- $cats->deleteCategory( $this->cat->getId(), $this->blog->getId());
-
- $blogs = new Blogs();
- $blogs->deleteBlog( $this->blog->getId());
-
- $users = new Users();
- $users->deleteUser( $this->owner->getId());
+ TestTools::deleteDaoTestData(Array($this->cat, $this->user));
+ TestTools::deleteBlog( $this->blog );
}
/**
@@ -97,7 +38,7 @@
"topic",
"text",
Array( $this->cat->getId()),
- $this->owner->getId(),
+ $this->user->getId(),
$this->blog->getId(),
POST_STATUS_PUBLISHED,
0
@@ -125,7 +66,12 @@
$this->assertFalse( $found, "A post with date in the future was returned by getRecentPosts" );
- $this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId()));
+ $this->assertTrue(
+ $articles->deleteArticle( $article->getId(),
+ $this->user->getId(),
+ $this->blog->getId(),
+ true),
+ "Could not delete article!");
}
}
?>
\ No newline at end of file
More information about the pLog-svn
mailing list