]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
test automatic search history deletion
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Mon, 27 Sep 2010 20:47:41 +0000 (20:47 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Mon, 27 Sep 2010 20:47:41 +0000 (20:47 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@761 b3834d28-1941-0410-a4f8-b48e95affb8f

tests/SearchHistoryTest.php

index ed353b9d5e110551626ef46491fe15883ce4e09e..55459054907b833c89c227a7f3486aefe045dc01 100644 (file)
@@ -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;