]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
test for beginsWith parameter and a bugfix :)
authorChristian Weiske <cweiske@cweiske.de>
Sat, 26 Mar 2011 10:54:47 +0000 (11:54 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Sat, 26 Mar 2011 10:54:47 +0000 (11:54 +0100)
tests/ajax/GetContactTagsTest.php
www/ajax/getcontacttags.php

index 757dce90f4c2810a1bfd07125c1aa3157efd853a..6e40444a922620bc71960529a6a58d5308f0d831 100644 (file)
@@ -71,6 +71,23 @@ class ajax_GetContactTagsTest extends TestBaseApi
         $this->assertContains('public2', $data);
         $this->assertContains('user2tag', $data);
     }
+
+    public function testParameterBeginsWith()
+    {
+        list($req, $uId) = $this->getLoggedInRequest('?beginsWith=bar');
+        $this->addBookmark($uId, null, 0, array('foobar', 'barmann'));
+
+        $res = $req->send();
+        $this->assertEquals(200, $res->getStatus());
+        $this->assertEquals(
+            'application/json; charset=utf-8',
+            $res->getHeader('content-type')
+        );
+        $data = json_decode($res->getBody());
+        $this->assertInternalType('array', $data);
+        $this->assertEquals(1, count($data));
+        $this->assertContains('barmann', $data);
+    }
 }
 
 
index 1377fea195c335996a69f4aa24403520466afd89..d3532266c3d9493dd889d705918ec4da77c4dd34 100644 (file)
@@ -36,7 +36,7 @@ if (isset($_GET['beginsWith']) && strlen(trim($_GET['beginsWith']))) {
 }
 
 $listTags = SemanticScuttle_Service_Factory::get('Bookmark2Tag')->getContactTags(
-    $currentUserId, $limit, $currentUserId, $beginsWith
+    $currentUserId, $limit, $currentUserId, null, $beginsWith
 );
 $tags = array();
 foreach ($listTags as $t) {