use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
+use Symfony\Component\HttpFoundation\Response;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Service\Extractor;
$json = $this->get('serializer')->serialize($entry->getTags(), 'json');
- return new JsonResponse($json, 200);
+ return new Response($json, 200, array('application/json'));
}
/**
$entry3->setTitle('test title entry3');
$entry3->setContent('This is my content /o/');
- $tag1 = new Tag($this->getReference('admin-user'));
+ $tag1 = new Tag($this->getReference('bob-user'));
$tag1->setLabel("foo");
- $tag2 = new Tag($this->getReference('admin-user'));
+ $tag2 = new Tag($this->getReference('bob-user'));
$tag2->setLabel("bar");
$entry3->addTag($tag1);
$this->addReference('entry3', $entry3);
+ $entry4 = new Entry($this->getReference('admin-user'));
+ $entry4->setUrl('http://0.0.0.0');
+ $entry4->setTitle('test title entry4');
+ $entry4->setContent('This is my content /o/');
+
+ $tag1 = new Tag($this->getReference('admin-user'));
+ $tag1->setLabel("foo");
+ $tag2 = new Tag($this->getReference('admin-user'));
+ $tag2->setLabel("bar");
+
+ $entry4->addTag($tag1);
+ $entry4->addTag($tag2);
+
+ $manager->persist($entry4);
+
+ $this->addReference('entry4', $entry4);
+
$manager->flush();
}
->getRepository('WallabagCoreBundle:Entry')
->findOneWithTags(1);
+ $entry = $entry[0];
+
if (!$entry) {
$this->markTestSkipped('No content found in db.');
}
$client->request('GET', '/api/entries/'.$entry->getId().'/tags', array(), array(), $headers);
- $this->assertEquals(json_encode($tags), $client->getResponse()->getContent());
+ $this->assertEquals(json_encode($tags, JSON_HEX_QUOT), $client->getResponse()->getContent());
}
public function testPostTagsOnEntry()