aboutsummaryrefslogtreecommitdiff
path: root/tests/SearchHistoryTest.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-09-27 20:47:41 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-09-27 20:47:41 +0000
commit42666d0991acd687a65117c834f06f9fe6434c4a (patch)
treee88707d5db475e6e4cc545a01fb266bcb42f11fa /tests/SearchHistoryTest.php
parenta242689285bf74be97925204745a68e491543abd (diff)
downloadsemanticscuttle-42666d0991acd687a65117c834f06f9fe6434c4a.tar.gz
semanticscuttle-42666d0991acd687a65117c834f06f9fe6434c4a.tar.bz2
test automatic search history deletion
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@761 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/SearchHistoryTest.php')
-rw-r--r--tests/SearchHistoryTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/SearchHistoryTest.php b/tests/SearchHistoryTest.php
index ed353b9..5545905 100644
--- a/tests/SearchHistoryTest.php
+++ b/tests/SearchHistoryTest.php
@@ -108,6 +108,34 @@ class SearchHistoryTest extends TestBase
$this->assertEquals(0, $this->shs->countSearches());
}
+ /**
+ * Tests if adding a search deletes the history if it is too
+ * large.
+ *
+ * @covers SemanticScuttle_Service_SearchHistory::addSearch
+ */
+ public function testAddSearchDeleteHistory()
+ {
+ $this->assertEquals(0, $this->shs->countSearches());
+
+ $this->shs->sizeSearchHistory = 5;
+ $this->shs->addSearch('eins', 'all', 1);
+ $this->shs->addSearch('zwei', 'all', 1);
+ $this->shs->addSearch('drei', 'all', 1);
+ $this->shs->addSearch('view', 'all', 1);
+ $this->shs->addSearch('fünf', 'all', 1);
+ $this->assertEquals(5, $this->shs->countSearches());
+
+ $this->shs->addSearch('sechs', 'all', 1);
+ $this->assertEquals(5, $this->shs->countSearches());
+
+ $this->shs->sizeSearchHistory = 6;
+ $this->shs->addSearch('sieben', 'all', 1);
+ $this->assertEquals(6, $this->shs->countSearches());
+ $this->shs->addSearch('acht', 'all', 1);
+ $this->assertEquals(6, $this->shs->countSearches());
+ }
+
public function testSearchHistory()
{
$shs = $this->shs;