1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-15 19:42:08 +00:00

relation between tags and entries

This commit is contained in:
Nicolas Lœuillet 2015-02-24 07:42:09 +01:00
parent 6c87418ff0
commit 46bbd8d321
7 changed files with 60 additions and 148 deletions

View file

@ -150,4 +150,30 @@ class WallabagRestControllerTest extends WallabagTestCase
$this->assertEquals(404, $client->getResponse()->getStatusCode());
}
public function testGetTagsEntry()
{
$client = $this->createClient();
$client->request('GET', '/api/salts/admin.json');
$salt = json_decode($client->getResponse()->getContent());
$headers = $this->generateHeaders('admin', 'test', $salt[0]);
$entry = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->findOneWithTags();
if (!$entry) {
$this->markTestSkipped('No content found in db.');
}
$tags = array();
foreach ($entry->getTags() as $tag) {
$tags[] = array('id' => $tag->getId(), 'label' => $tag->getLabel());
}
$client->request('GET', '/api/entries/'.$entry->getId().'/tags', array(), array(), $headers);
$this->assertEquals(json_encode($tags), $client->getResponse()->getContent());
}
}