diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-03-16 21:40:36 +0100 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-03-16 21:40:36 +0100 |
commit | 3500d4099f88f7db22eba42fdb7e8926f1f1cdac (patch) | |
tree | a738ada4e0aaa8f915c8f1aa5f7f916617b70990 /src/Wallabag/ApiBundle/Tests | |
parent | 17051137ec7cb4273dd2da6bca58e245d648e34a (diff) | |
parent | 3107f92acb638bb5bf8067daaa5500ae65b5b116 (diff) | |
download | wallabag-3500d4099f88f7db22eba42fdb7e8926f1f1cdac.tar.gz wallabag-3500d4099f88f7db22eba42fdb7e8926f1f1cdac.tar.zst wallabag-3500d4099f88f7db22eba42fdb7e8926f1f1cdac.zip |
Merge pull request #1797 from wallabag/v2-fix-adding-entry-API
Don't add entry through API if it already exists
Diffstat (limited to 'src/Wallabag/ApiBundle/Tests')
-rw-r--r-- | src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php index c264180c..2e78d8b2 100644 --- a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php | |||
@@ -166,6 +166,24 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
166 | $this->assertCount(1, $content['tags']); | 166 | $this->assertCount(1, $content['tags']); |
167 | } | 167 | } |
168 | 168 | ||
169 | public function testPostSameEntry() | ||
170 | { | ||
171 | $this->client->request('POST', '/api/entries.json', array( | ||
172 | 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', | ||
173 | 'archive' => '1', | ||
174 | )); | ||
175 | |||
176 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
177 | |||
178 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
179 | |||
180 | $this->assertGreaterThan(0, $content['id']); | ||
181 | $this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); | ||
182 | $this->assertEquals(true, $content['is_archived']); | ||
183 | $this->assertEquals(false, $content['is_starred']); | ||
184 | $this->assertCount(1, $content['tags']); | ||
185 | } | ||
186 | |||
169 | public function testPostArchivedAndStarredEntry() | 187 | public function testPostArchivedAndStarredEntry() |
170 | { | 188 | { |
171 | $this->client->request('POST', '/api/entries.json', array( | 189 | $this->client->request('POST', '/api/entries.json', array( |