test for beginsWith parameter and a bugfix :)
This commit is contained in:
parent
0f9d06c664
commit
78654369e9
2 changed files with 18 additions and 1 deletions
|
@ -71,6 +71,23 @@ class ajax_GetContactTagsTest extends TestBaseApi
|
||||||
$this->assertContains('public2', $data);
|
$this->assertContains('public2', $data);
|
||||||
$this->assertContains('user2tag', $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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ if (isset($_GET['beginsWith']) && strlen(trim($_GET['beginsWith']))) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$listTags = SemanticScuttle_Service_Factory::get('Bookmark2Tag')->getContactTags(
|
$listTags = SemanticScuttle_Service_Factory::get('Bookmark2Tag')->getContactTags(
|
||||||
$currentUserId, $limit, $currentUserId, $beginsWith
|
$currentUserId, $limit, $currentUserId, null, $beginsWith
|
||||||
);
|
);
|
||||||
$tags = array();
|
$tags = array();
|
||||||
foreach ($listTags as $t) {
|
foreach ($listTags as $t) {
|
||||||
|
|
Loading…
Reference in a new issue