$entry = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
- ->findOneByIsDeleted(false);
+ ->findOneByUser(1);
if (!$entry) {
$this->markTestSkipped('No content found in db.');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
- $res = $client->getContainer()
+ // We'll try to delete this entry again
+ $client->request('GET', '/api/salts/admin.json');
+ $salt = json_decode($client->getResponse()->getContent());
+
+ $headers = $this->generateHeaders('admin', 'test', $salt[0]);
+
+ $client->request('DELETE', '/api/entries/'.$entry->getId().'.json', array(), array(), $headers);
+
+ $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')
- ->findOneById($entry->getId());
- $this->assertEquals($res->isDeleted(), true);
+ ->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());
}
}