[pLog-svn] r6674 - in plog/branches/lifetype-1.2/class/test: helpers tests/dao tests/ui
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Mon Jun 23 18:41:03 EDT 2008
Author: jondaley
Date: 2008-06-23 18:41:02 -0400 (Mon, 23 Jun 2008)
New Revision: 6674
Modified:
plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php
plog/branches/lifetype-1.2/class/test/tests/dao/articlecategories_test.class.php
plog/branches/lifetype-1.2/class/test/tests/dao/commentscommon_test.class.php
plog/branches/lifetype-1.2/class/test/tests/dao/searchengine_test.class.php
plog/branches/lifetype-1.2/class/test/tests/ui/articlecategoriesui_test.class.php
plog/branches/lifetype-1.2/class/test/tests/ui/login_test.class.php
plog/branches/lifetype-1.2/class/test/tests/ui/permissionsui_test.class.php
Log:
better cleanup of tests
Modified: plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php 2008-06-23 22:21:38 UTC (rev 6673)
+++ plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php 2008-06-23 22:41:02 UTC (rev 6674)
@@ -51,7 +51,20 @@
return $blog;
}
-
+
+ /**
+ * Delete a blog and the default category
+ * (Note: Why doesn't a blog erase relevant stuff when it is erased?
+ * Maybe the blogs->deleteBlog should be a private function,
+ * and outside folks always call purgeBlog instead??)
+ */
+ function deleteBlog( $blog ){
+ $articleCategories = new ArticleCategories();
+ $articleCategories->deleteBlogCategories( $blog->getId() );
+
+ TestTools::deleteDaoTestData(Array($blog));
+ }
+
/**
* Creates a temporary user with minimal (login only) permissions
*
Modified: plog/branches/lifetype-1.2/class/test/tests/dao/articlecategories_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/dao/articlecategories_test.class.php 2008-06-23 22:21:38 UTC (rev 6673)
+++ plog/branches/lifetype-1.2/class/test/tests/dao/articlecategories_test.class.php 2008-06-23 22:41:02 UTC (rev 6674)
@@ -28,8 +28,8 @@
TestTools::deleteDaoTestData( $this->data["articles"] );
TestTools::deleteDaoTestData( $this->data["categories"] );
TestTools::deleteDaoTestData( Array( $this->article,
- $this->data["blog"],
$this->data["user"] ));
+ TestTools::deleteBlog($this->data["blog"]);
}
/**
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:21:38 UTC (rev 6673)
+++ plog/branches/lifetype-1.2/class/test/tests/dao/commentscommon_test.class.php 2008-06-23 22:41:02 UTC (rev 6674)
@@ -199,7 +199,8 @@
$this->assertEquals( $origTime->getTimestamp(), $newTime->getTimestamp(), "Comment times are not the same!" );
// destroy the test data
- TestTools::deleteDaoTestData( Array( $comment, $comment2, $article, $cat, $blog, $user));
+ TestTools::deleteDaoTestData( Array( $comment, $comment2, $article, $cat, $user));
+ TestTools::deleteBlog( $blog );
}
}
?>
Modified: plog/branches/lifetype-1.2/class/test/tests/dao/searchengine_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/dao/searchengine_test.class.php 2008-06-23 22:21:38 UTC (rev 6673)
+++ plog/branches/lifetype-1.2/class/test/tests/dao/searchengine_test.class.php 2008-06-23 22:41:02 UTC (rev 6674)
@@ -47,8 +47,9 @@
function tearDown()
{
TestTools::deleteDaoTestData(
- Array( $this->art1, $this->art2, $this->cat, $this->blog, $this->user)
+ Array( $this->art1, $this->art2, $this->cat, $this->user)
);
+ TestTools::deleteBlog( $this->blog );
}
/**
@@ -56,7 +57,7 @@
*/
function testSearchIgnoreFuturePosts()
{
- // check that when searching for this specific string, we only get one match (there should only be one test article)
+ // check that when searching for this specific string, we only get one match (there should only be one test article)
$searchEngine = new SearchEngine();
$results = $searchEngine->search( $this->blog->getId(), "test article", POST_STATUS_PUBLISHED, false );
$this->assertEquals( 1, count( $results ), "There should only be one article in the search results" );
@@ -83,9 +84,9 @@
// check that when searching for this specific string,
// we only get one match (there should only be one test article)
$searchEngine = new SearchEngine();
- $results = $searchEngine->siteSearch( "test article", SEARCH_ARTICLE, POST_STATUS_PUBLISHED, false );
+ $results = $searchEngine->siteSearch("test article", SEARCH_ARTICLE,
+ POST_STATUS_PUBLISHED, false);
$this->assertEquals( 1, count( $results ), "There should only be one article in the search results" );
-
// check that the article with the future date is not part of the results
foreach( $results as $result ) {
if( $result->getType() == SEARCH_RESULT_ARTICLE ) {
@@ -95,8 +96,10 @@
}
// and finally check that the amount of search results returned is valid
- $this->assertEquals( 1, $searchEngine->getNumSiteSearchResults( "test article", SEARCH_ARTICLE, POST_STATUS_PUBLISHED, false ),
- "The future article was counted by SearchEngine::getNumSiteSearchResults()!" );
+ $numResults = $searchEngine->getNumSiteSearchResults(
+ "test article", SEARCH_ARTICLE, POST_STATUS_PUBLISHED, false );
+ $this->assertEquals(1, $numResults,
+ "The future article was counted by getNumSiteSearchResults()!");
}
}
?>
\ No newline at end of file
Modified: plog/branches/lifetype-1.2/class/test/tests/ui/articlecategoriesui_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/ui/articlecategoriesui_test.class.php 2008-06-23 22:21:38 UTC (rev 6673)
+++ plog/branches/lifetype-1.2/class/test/tests/ui/articlecategoriesui_test.class.php 2008-06-23 22:41:02 UTC (rev 6674)
@@ -19,7 +19,8 @@
function tearDown()
{
- TestTools::deleteDaoTestData( Array( $this->user, $this->blog ));
+ TestTools::deleteDaoTestData( Array( $this->user ));
+ TestTools::deleteBlog( $this->blog );
}
/**
Modified: plog/branches/lifetype-1.2/class/test/tests/ui/login_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/ui/login_test.class.php 2008-06-23 22:21:38 UTC (rev 6673)
+++ plog/branches/lifetype-1.2/class/test/tests/ui/login_test.class.php 2008-06-23 22:41:02 UTC (rev 6674)
@@ -35,8 +35,8 @@
function tearDown()
{
- TestTools::deleteDaoTestData( Array( $this->user, $this->user2,
- $this->user3, $this->blog ));
+ TestTools::deleteDaoTestData( Array( $this->user, $this->user2, $this->user3 ));
+ TestTools::deleteBlog( $this->blog );
}
/**
Modified: plog/branches/lifetype-1.2/class/test/tests/ui/permissionsui_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/ui/permissionsui_test.class.php 2008-06-23 22:21:38 UTC (rev 6673)
+++ plog/branches/lifetype-1.2/class/test/tests/ui/permissionsui_test.class.php 2008-06-23 22:41:02 UTC (rev 6674)
@@ -21,7 +21,8 @@
function tearDown()
{
- TestTools::deleteDaoTestData( Array( $this->user, $this->blog ));
+ TestTools::deleteDaoTestData( Array( $this->user ));
+ TestTools::deleteBlog( $this->blog );
}
/**
More information about the pLog-svn
mailing list