aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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}