aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-12-31 11:24:46 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-01-02 23:27:41 +0100
commit7019c7cf6c6af39c0f458769e20c3f9306477943 (patch)
tree12acceaa458cdf6d24367eba85f690265acddcdb /src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php
parentb1d05721cf37ab94ec1a6837fe79cf19474dd0ff (diff)
downloadwallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.tar.gz
wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.tar.zst
wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.zip
Add tagged services for import
- list services in /import - add url to import service - ImportBundle routing are now prefixed by /import - optimize flush in each import (flushing each 20 contents) - improve design of each import - add more tests
Diffstat (limited to 'src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php')
-rw-r--r--src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php
new file mode 100644
index 00000000..c2acd68c
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php
@@ -0,0 +1,42 @@
1<?php
2
3namespace Wallabag\ImportBundle\Tests\Controller;
4
5use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
6
7class PocketControllerTest extends WallabagCoreTestCase
8{
9 public function testImportPocket()
10 {
11 $this->logInAs('admin');
12 $client = $this->getClient();
13
14 $crawler = $client->request('GET', '/import/pocket');
15
16 $this->assertEquals(200, $client->getResponse()->getStatusCode());
17 $this->assertEquals(1, $crawler->filter('button[type=submit]')->count());
18 }
19
20 public function testImportPocketAuth()
21 {
22 $this->logInAs('admin');
23 $client = $this->getClient();
24
25 $crawler = $client->request('GET', '/import/pocket/auth');
26
27 $this->assertEquals(301, $client->getResponse()->getStatusCode());
28 $this->assertContains('getpocket.com/auth/authorize', $client->getResponse()->headers->get('location'));
29 }
30
31 public function testImportPocketCallbackWithBadToken()
32 {
33 $this->logInAs('admin');
34 $client = $this->getClient();
35
36 $crawler = $client->request('GET', '/import/pocket/callback');
37
38 $this->assertEquals(302, $client->getResponse()->getStatusCode());
39 $this->assertContains('import/pocket', $client->getResponse()->headers->get('location'));
40 $this->assertEquals('Import failed, please try again.', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]);
41 }
42}