From 4f61d0695ad52d9bbf89cf4d27a8140b594bed3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 9 Jan 2014 09:57:37 +0100 Subject: [PATCH] [add] test for getEntryById --- tests/functionals/ApiTest.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/functionals/ApiTest.php b/tests/functionals/ApiTest.php index ca513c9..1650035 100644 --- a/tests/functionals/ApiTest.php +++ b/tests/functionals/ApiTest.php @@ -46,6 +46,36 @@ class ApiTest extends PocheWebTestCase } + public function testGetEntryById() + { + + //Load some entries + Fixtures::loadEntries($this->app['db']); + + $client = $this->createClient(); + $crawler = $client->request( + 'GET', + '/api/get', + array(), + array(), + array('CONTENT_TYPE' => 'application/json'), + '{"id":"1"}' + ); + + $this->assertEquals($client->getResponse()->getStatusCode(), 201); + + // Assert that the "Content-Type" header is "application/json" + $this->assertTrue( + $client->getResponse()->headers->contains( + 'Content-Type', + 'application/json' + ) + ); + + $this->assertEquals('[{"id":"1","url":"http:\/\/deboutlesgens.com\/blog\/le-courage-de-vivre-consciemment\/","title":"Le courage de vivre consciemment","content":"Test content","updated":null,"status":null,"bookmark":"0","fetched":"1","user_id":"1"}]', $client->getResponse()->getContent()); + + } + public function testPostEntries() {