aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle/Controller
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-11-20 13:08:41 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-11-20 13:08:41 +0100
commit0a6f4568b5e4f6291cc19cbea929ed1ebeca3a54 (patch)
tree26e9852f4b38d44b63a67216921c2a25feadd095 /tests/Wallabag/ApiBundle/Controller
parent5ae8788583a63973c89a5a83f1a6880ce04b49d7 (diff)
downloadwallabag-0a6f4568b5e4f6291cc19cbea929ed1ebeca3a54.tar.gz
wallabag-0a6f4568b5e4f6291cc19cbea929ed1ebeca3a54.tar.zst
wallabag-0a6f4568b5e4f6291cc19cbea929ed1ebeca3a54.zip
Add ability to reload entry from API
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 566e9493..3c8b7980 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -678,4 +678,41 @@ class EntryRestControllerTest extends WallabagApiTestCase
678 678
679 $this->assertEquals(403, $this->client->getResponse()->getStatusCode()); 679 $this->assertEquals(403, $this->client->getResponse()->getStatusCode());
680 } 680 }
681
682 public function testReloadEntryErrorWhileFetching()
683 {
684 $entry = $this->client->getContainer()
685 ->get('doctrine.orm.entity_manager')
686 ->getRepository('WallabagCoreBundle:Entry')
687 ->findOneBy(['user' => 1, 'isArchived' => false]);
688
689 if (!$entry) {
690 $this->markTestSkipped('No content found in db.');
691 }
692
693 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'/reload.json');
694 $this->assertEquals(304, $this->client->getResponse()->getStatusCode());
695 }
696
697 public function testReloadEntry()
698 {
699 $this->client->request('POST', '/api/entries.json', [
700 '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',
701 'archive' => '1',
702 'tags' => 'google, apple',
703 ]);
704
705 $json = json_decode($this->client->getResponse()->getContent(), true);
706
707 $this->setUp();
708
709 $this->client->request('PATCH', '/api/entries/'.$json['id'].'/reload.json');
710 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
711
712 $content = json_decode($this->client->getResponse()->getContent(), true);
713
714 $this->assertNotEmpty($content['title']);
715
716 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
717 }
681} 718}