[pLog-svn] r6653 - plog/branches/lifetype-1.2/class/test/tests/dao
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Mon Jun 23 13:56:11 EDT 2008
Author: jondaley
Date: 2008-06-23 13:56:10 -0400 (Mon, 23 Jun 2008)
New Revision: 6653
Modified:
plog/branches/lifetype-1.2/class/test/tests/dao/searchengine_test.class.php
Log:
fixed comment on test error. Added sleep so the mysql test for NOW() actually works.
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 17:00:41 UTC (rev 6652)
+++ plog/branches/lifetype-1.2/class/test/tests/dao/searchengine_test.class.php 2008-06-23 17:56:10 UTC (rev 6653)
@@ -34,7 +34,10 @@
// and one with future date
$t = new Timestamp();
$t->addSeconds( 60 * 60 * 10 );
- $this->art2 = TestTools::createArticle( $this->blog->getId(), $this->user->getId(), Array( $this->cat->getId()), POST_STATUS_PUBLISHED, $t );
+ $this->art2 = TestTools::createArticle( $this->blog->getId(), $this->user->getId(), Array( $this->cat->getId()), POST_STATUS_PUBLISHED, $t );
+
+ sleep(1); // have to sleep, otherwise the search for "time < NOW()" will return false
+ // for all articles. Alternatively, the searchengine could use "time <= NOW()"
}
/**
@@ -55,7 +58,7 @@
{
// 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 );
+ $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" );
// check that the article with the future date is not part of the results
@@ -68,7 +71,7 @@
// and finally check that the amount of search results returned is valid
$this->assertEquals( 1, $searchEngine->getNumSearchResults( $this->blog->getId(), "test article", POST_STATUS_PUBLISHED, false ),
- "The future article was counted by SearchEngine::getNumSearchResults()!" );
+ "SearchEngine::getNumSearchResults() returned additional articles???" );
}
/**
@@ -77,7 +80,8 @@
*/
function testSiteSearchIgnoreFuturePosts()
{
- // 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->siteSearch( "test article", SEARCH_ARTICLE, POST_STATUS_PUBLISHED, false );
$this->assertEquals( 1, count( $results ), "There should only be one article in the search results" );
More information about the pLog-svn
mailing list