mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-28 10:30:28 +00:00
fix tests for GET /entries/tags
This commit is contained in:
parent
1df1204d94
commit
b0cce9e636
3 changed files with 24 additions and 4 deletions
|
@ -6,6 +6,7 @@ use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
|||
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;
|
||||
|
@ -246,7 +247,7 @@ class WallabagRestController extends Controller
|
|||
|
||||
$json = $this->get('serializer')->serialize($entry->getTags(), 'json');
|
||||
|
||||
return new JsonResponse($json, 200);
|
||||
return new Response($json, 200, array('application/json'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,9 +38,9 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
|
|||
$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);
|
||||
|
@ -50,6 +50,23 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
|
|||
|
||||
$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();
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,8 @@ class WallabagRestControllerTest extends WallabagTestCase
|
|||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findOneWithTags(1);
|
||||
|
||||
$entry = $entry[0];
|
||||
|
||||
if (!$entry) {
|
||||
$this->markTestSkipped('No content found in db.');
|
||||
}
|
||||
|
@ -170,7 +172,7 @@ class WallabagRestControllerTest extends WallabagTestCase
|
|||
|
||||
$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()
|
||||
|
|
Loading…
Reference in a new issue