From 0b174d69d77770fab617661c284095bc61d30c10 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 5 Oct 2016 19:30:56 +0200 Subject: [PATCH] Fix typo & add test --- .../ApiBundle/Controller/WallabagRestController.php | 2 +- .../ApiBundle/Controller/WallabagRestControllerTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index b2c73932e..a0d9d4f3a 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -40,7 +40,7 @@ class WallabagRestController extends FOSRestController $url = $request->query->get('url', ''); if (empty($url)) { - throw $this->createAccessDeniedException('URL is empty?, logged user id: '.$this->getUser->getId()); + throw $this->createAccessDeniedException('URL is empty?, logged user id: '.$this->getUser()->getId()); } $res = $this->getDoctrine() diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index fd72b8f22..65b65290c 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php @@ -804,4 +804,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase $this->assertEquals(false, $content['exists']); } + + public function testGetEntriesExistsWithNoUrl() + { + $this->client->request('GET', '/api/entries/exists?url='); + + $this->assertEquals(403, $this->client->getResponse()->getStatusCode()); + } }