aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ImportBundle
diff options
context:
space:
mode:
authorlizyn <zhiylin@outlook.com>2020-02-24 10:04:13 +0800
committerGitHub <noreply@github.com>2020-02-24 10:04:13 +0800
commitb19df31d78d881a43bcf6b3215e5fc3781e8e8aa (patch)
treed0d9861694a4b5e5fbfdbeb53c255ecd15fe9328 /tests/Wallabag/ImportBundle
parent4d0c632c70ea50d459c3c55ddda2e0f394dd51cb (diff)
parent04d918cae0227c06a41d27fb6533dddbf30dfe71 (diff)
downloadwallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.gz
wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.zst
wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.zip
Merge pull request #1 from wallabag/master
Keep up with the master again
Diffstat (limited to 'tests/Wallabag/ImportBundle')
-rw-r--r--tests/Wallabag/ImportBundle/Command/ImportCommandTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php132
-rw-r--r--tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php411
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/elcurator.json13
14 files changed, 350 insertions, 238 deletions
diff --git a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
index f95320a4..8e1c528d 100644
--- a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
+++ b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
@@ -84,6 +84,8 @@ class ImportCommandTest extends WallabagCoreTestCase
84 84
85 public function testRunImportCommandWithUserId() 85 public function testRunImportCommandWithUserId()
86 { 86 {
87 $this->logInAs('admin');
88
87 $application = new Application($this->getClient()->getKernel()); 89 $application = new Application($this->getClient()->getKernel());
88 $application->add(new ImportCommand()); 90 $application->add(new ImportCommand());
89 91
@@ -92,7 +94,7 @@ class ImportCommandTest extends WallabagCoreTestCase
92 $tester = new CommandTester($command); 94 $tester = new CommandTester($command);
93 $tester->execute([ 95 $tester->execute([
94 'command' => $command->getName(), 96 'command' => $command->getName(),
95 'username' => 1, 97 'username' => $this->getLoggedInUserId(),
96 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', 98 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
97 '--useUserId' => true, 99 '--useUserId' => true,
98 '--importer' => 'v2', 100 '--importer' => 'v2',
diff --git a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php
index b2141c04..b7f6192d 100644
--- a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php
+++ b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2 2
3namespace Tests\Wallabag\ImportBundle\Consumer\AMQP; 3namespace Tests\Wallabag\ImportBundle\Consumer;
4 4
5use PhpAmqpLib\Message\AMQPMessage; 5use PhpAmqpLib\Message\AMQPMessage;
6use PHPUnit\Framework\TestCase; 6use PHPUnit\Framework\TestCase;
diff --git a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
index 61337e47..e1bd8827 100644
--- a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
+++ b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2 2
3namespace Tests\Wallabag\ImportBundle\Consumer\AMQP; 3namespace Tests\Wallabag\ImportBundle\Consumer;
4 4
5use PHPUnit\Framework\TestCase; 5use PHPUnit\Framework\TestCase;
6use Wallabag\CoreBundle\Entity\Entry; 6use Wallabag\CoreBundle\Entity\Entry;
diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
index cd3e41e9..d3ffbb6d 100644
--- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
@@ -121,7 +121,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok');
124 $this->assertSame(1, \count($content->getTags())); 124 $this->assertCount(1, $content->getTags());
125 125
126 $createdAt = $content->getCreatedAt(); 126 $createdAt = $content->getCreatedAt();
127 $this->assertSame('2011', $createdAt->format('Y')); 127 $this->assertSame('2011', $createdAt->format('Y'));
diff --git a/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php
new file mode 100644
index 00000000..b9919f8f
--- /dev/null
+++ b/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php
@@ -0,0 +1,132 @@
1<?php
2
3namespace Tests\Wallabag\ImportBundle\Controller;
4
5use Symfony\Component\HttpFoundation\File\UploadedFile;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7
8class ElcuratorControllerTest extends WallabagCoreTestCase
9{
10 public function testImportElcurator()
11 {
12 $this->logInAs('admin');
13 $client = $this->getClient();
14
15 $crawler = $client->request('GET', '/import/elcurator');
16
17 $this->assertSame(200, $client->getResponse()->getStatusCode());
18 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
20 }
21
22 public function testImportElcuratorWithRabbitEnabled()
23 {
24 $this->logInAs('admin');
25 $client = $this->getClient();
26
27 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
28
29 $crawler = $client->request('GET', '/import/elcurator');
30
31 $this->assertSame(200, $client->getResponse()->getStatusCode());
32 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 }
37
38 public function testImportElcuratorBadFile()
39 {
40 $this->logInAs('admin');
41 $client = $this->getClient();
42
43 $crawler = $client->request('GET', '/import/elcurator');
44 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
45
46 $data = [
47 'upload_import_file[file]' => '',
48 ];
49
50 $client->submit($form, $data);
51
52 $this->assertSame(200, $client->getResponse()->getStatusCode());
53 }
54
55 public function testImportElcuratorWithRedisEnabled()
56 {
57 $this->checkRedis();
58 $this->logInAs('admin');
59 $client = $this->getClient();
60
61 $client->getContainer()->get('craue_config')->set('import_with_redis', 1);
62
63 $crawler = $client->request('GET', '/import/elcurator');
64
65 $this->assertSame(200, $client->getResponse()->getStatusCode());
66 $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
67 $this->assertSame(1, $crawler->filter('input[type=file]')->count());
68
69 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
70
71 $file = new UploadedFile(__DIR__ . '/../fixtures/elcurator.json', 'elcurator.json');
72
73 $data = [
74 'upload_import_file[file]' => $file,
75 ];
76
77 $client->submit($form, $data);
78
79 $this->assertSame(302, $client->getResponse()->getStatusCode());
80
81 $crawler = $client->followRedirect();
82
83 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
84 $this->assertContains('flashes.import.notice.summary', $body[0]);
85
86 $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.elcurator'));
87
88 $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
89 }
90
91 public function testImportElcuratorWithFile()
92 {
93 $this->logInAs('admin');
94 $client = $this->getClient();
95
96 $crawler = $client->request('GET', '/import/elcurator');
97 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
98
99 $file = new UploadedFile(__DIR__ . '/../fixtures/elcurator.json', 'elcurator.json');
100
101 $data = [
102 'upload_import_file[file]' => $file,
103 ];
104
105 $client->submit($form, $data);
106
107 $this->assertSame(302, $client->getResponse()->getStatusCode());
108
109 $crawler = $client->followRedirect();
110
111 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
112 $this->assertContains('flashes.import.notice.summary', $body[0]);
113
114 $content = $client->getContainer()
115 ->get('doctrine.orm.entity_manager')
116 ->getRepository('WallabagCoreBundle:Entry')
117 ->findByUrlAndUserId(
118 'https://devblog.lexik.fr/git/qualite-de-code-integration-de-php-git-hooks-dans-symfony2-2842',
119 $this->getLoggedInUserId()
120 );
121
122 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
123
124 $this->assertSame('Qualité de code - Intégration de php-git-hooks dans Symfony2 - Experts Symfony et Drupal - Lexik', $content->getTitle());
125 $this->assertSame('2015-09-09', $content->getCreatedAt()->format('Y-m-d'));
126 $this->assertTrue($content->isStarred(), 'Entry is starred');
127
128 $tags = $content->getTags();
129 $this->assertContains('tag1', $tags, 'It includes the "tag1" tag');
130 $this->assertContains('tag2', $tags, 'It includes the "tag2" tag');
131 }
132}
diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
index dc5ed6d0..3e64f2e5 100644
--- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
@@ -122,7 +122,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok'); 122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok');
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); 123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok'); 124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok');
125 $this->assertSame(3, \count($content->getTags())); 125 $this->assertCount(3, $content->getTags());
126 126
127 $content = $client->getContainer() 127 $content = $client->getContainer()
128 ->get('doctrine.orm.entity_manager') 128 ->get('doctrine.orm.entity_manager')
diff --git a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
index e1ec7c65..f0edb78d 100644
--- a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
@@ -24,6 +24,6 @@ class ImportControllerTest extends WallabagCoreTestCase
24 $crawler = $client->request('GET', '/import/'); 24 $crawler = $client->request('GET', '/import/');
25 25
26 $this->assertSame(200, $client->getResponse()->getStatusCode()); 26 $this->assertSame(200, $client->getResponse()->getStatusCode());
27 $this->assertSame(8, $crawler->filter('blockquote')->count()); 27 $this->assertSame(9, $crawler->filter('blockquote')->count());
28 } 28 }
29} 29}
diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
index 7390fa88..05347767 100644
--- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
@@ -124,7 +124,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
124 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.liberation.fr is ok'); 124 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.liberation.fr is ok');
125 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.liberation.fr is ok'); 125 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.liberation.fr is ok');
126 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag'); 126 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag');
127 $this->assertSame(1, \count($content->getTags())); 127 $this->assertCount(1, $content->getTags());
128 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 128 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
129 129
130 $content = $client->getContainer() 130 $content = $client->getContainer()
@@ -138,7 +138,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
138 $this->assertContains('foot', $content->getTags()); 138 $this->assertContains('foot', $content->getTags());
139 $this->assertContains('test_tag', $content->getTags()); 139 $this->assertContains('test_tag', $content->getTags());
140 140
141 $this->assertSame(2, \count($content->getTags())); 141 $this->assertCount(2, $content->getTags());
142 } 142 }
143 143
144 public function testImportInstapaperWithFileAndMarkAllAsRead() 144 public function testImportInstapaperWithFileAndMarkAllAsRead()
diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
index 80819f45..963759b1 100644
--- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
@@ -121,13 +121,13 @@ class PinboardControllerTest extends WallabagCoreTestCase
121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok'); 122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok');
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok'); 123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok'); 124 $this->assertNull($content->getLanguage(), 'Language for https://ma.ttias.be is null');
125 125
126 $tags = $content->getTags(); 126 $tags = $content->getTags();
127 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 127 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
128 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag'); 128 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag');
129 $this->assertContains('php', $tags, 'It includes the "php" tag'); 129 $this->assertContains('php', $tags, 'It includes the "php" tag');
130 $this->assertSame(3, \count($tags)); 130 $this->assertCount(3, $tags);
131 131
132 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 132 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
133 $this->assertSame('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); 133 $this->assertSame('2016-10-26', $content->getCreatedAt()->format('Y-m-d'));
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
index 5619659a..4f2f4053 100644
--- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
@@ -125,7 +125,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
125 125
126 $tags = $content->getTags(); 126 $tags = $content->getTags();
127 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 127 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
128 $this->assertSame(1, \count($tags)); 128 $this->assertCount(1, $tags);
129 129
130 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 130 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
131 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 131 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index c67941a7..2a8e7c89 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -121,13 +121,13 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
121 121
122 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 122 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
123 $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is empty'); 123 $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is empty');
124 $this->assertEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is empty'); 124 $this->assertSame($content->getPreviewPicture(), 'http://www.framablog.org/public/_img/framablog/wallaby_baby.jpg');
125 $this->assertEmpty($content->getLanguage(), 'Language for http://www.framablog.org is empty'); 125 $this->assertEmpty($content->getLanguage(), 'Language for http://www.framablog.org is empty');
126 126
127 $tags = $content->getTags(); 127 $tags = $content->getTags();
128 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 128 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
129 $this->assertContains('framabag', $tags, 'It includes the "framabag" tag'); 129 $this->assertContains('framabag', $tags, 'It includes the "framabag" tag');
130 $this->assertSame(2, \count($tags)); 130 $this->assertCount(2, $tags);
131 131
132 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 132 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
133 } 133 }
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
index 822656ba..b606e26a 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -128,7 +128,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
128 128
129 $tags = $content->getTags(); 129 $tags = $content->getTags();
130 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 130 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
131 $this->assertSame(1, \count($tags)); 131 $this->assertCount(1, $tags);
132 132
133 $content = $client->getContainer() 133 $content = $client->getContainer()
134 ->get('doctrine.orm.entity_manager') 134 ->get('doctrine.orm.entity_manager')
@@ -147,7 +147,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
147 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 147 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
148 $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag'); 148 $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag');
149 $this->assertContains('blog', $tags, 'It includes the "blog" tag'); 149 $this->assertContains('blog', $tags, 'It includes the "blog" tag');
150 $this->assertSame(3, \count($tags)); 150 $this->assertCount(3, $tags);
151 151
152 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 152 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
153 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 153 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index baa5d905..40e1626b 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -2,10 +2,8 @@
2 2
3namespace Tests\Wallabag\ImportBundle\Import; 3namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use GuzzleHttp\Client; 5use GuzzleHttp\Psr7\Response;
6use GuzzleHttp\Message\Response; 6use Http\Mock\Client as HttpMockClient;
7use GuzzleHttp\Stream\Stream;
8use GuzzleHttp\Subscriber\Mock;
9use M6Web\Component\RedisMock\RedisMockFactory; 7use M6Web\Component\RedisMock\RedisMockFactory;
10use Monolog\Handler\TestHandler; 8use Monolog\Handler\TestHandler;
11use Monolog\Logger; 9use Monolog\Logger;
@@ -38,16 +36,11 @@ class PocketImportTest extends TestCase
38 36
39 public function testOAuthRequest() 37 public function testOAuthRequest()
40 { 38 {
41 $client = new Client(); 39 $httpMockClient = new HttpMockClient();
42 40 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode(['code' => 'wunderbar_code'])));
43 $mock = new Mock([
44 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['code' => 'wunderbar_code']))),
45 ]);
46
47 $client->getEmitter()->attach($mock);
48 41
49 $pocketImport = $this->getPocketImport(); 42 $pocketImport = $this->getPocketImport();
50 $pocketImport->setClient($client); 43 $pocketImport->setClient($httpMockClient);
51 44
52 $code = $pocketImport->getRequestToken('http://0.0.0.0/redirect'); 45 $code = $pocketImport->getRequestToken('http://0.0.0.0/redirect');
53 46
@@ -56,16 +49,11 @@ class PocketImportTest extends TestCase
56 49
57 public function testOAuthRequestBadResponse() 50 public function testOAuthRequestBadResponse()
58 { 51 {
59 $client = new Client(); 52 $httpMockClient = new HttpMockClient();
60 53 $httpMockClient->addResponse(new Response(403));
61 $mock = new Mock([
62 new Response(403),
63 ]);
64
65 $client->getEmitter()->attach($mock);
66 54
67 $pocketImport = $this->getPocketImport(); 55 $pocketImport = $this->getPocketImport();
68 $pocketImport->setClient($client); 56 $pocketImport->setClient($httpMockClient);
69 57
70 $code = $pocketImport->getRequestToken('http://0.0.0.0/redirect'); 58 $code = $pocketImport->getRequestToken('http://0.0.0.0/redirect');
71 59
@@ -78,16 +66,11 @@ class PocketImportTest extends TestCase
78 66
79 public function testOAuthAuthorize() 67 public function testOAuthAuthorize()
80 { 68 {
81 $client = new Client(); 69 $httpMockClient = new HttpMockClient();
82 70 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode(['access_token' => 'wunderbar_token'])));
83 $mock = new Mock([
84 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))),
85 ]);
86
87 $client->getEmitter()->attach($mock);
88 71
89 $pocketImport = $this->getPocketImport(); 72 $pocketImport = $this->getPocketImport();
90 $pocketImport->setClient($client); 73 $pocketImport->setClient($httpMockClient);
91 74
92 $res = $pocketImport->authorize('wunderbar_code'); 75 $res = $pocketImport->authorize('wunderbar_code');
93 76
@@ -97,16 +80,11 @@ class PocketImportTest extends TestCase
97 80
98 public function testOAuthAuthorizeBadResponse() 81 public function testOAuthAuthorizeBadResponse()
99 { 82 {
100 $client = new Client(); 83 $httpMockClient = new HttpMockClient();
101 84 $httpMockClient->addResponse(new Response(403));
102 $mock = new Mock([
103 new Response(403),
104 ]);
105
106 $client->getEmitter()->attach($mock);
107 85
108 $pocketImport = $this->getPocketImport(); 86 $pocketImport = $this->getPocketImport();
109 $pocketImport->setClient($client); 87 $pocketImport->setClient($httpMockClient);
110 88
111 $res = $pocketImport->authorize('wunderbar_code'); 89 $res = $pocketImport->authorize('wunderbar_code');
112 90
@@ -122,94 +100,90 @@ class PocketImportTest extends TestCase
122 */ 100 */
123 public function testImport() 101 public function testImport()
124 { 102 {
125 $client = new Client(); 103 $httpMockClient = new HttpMockClient();
126 104 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode(['access_token' => 'wunderbar_token'])));
127 $mock = new Mock([ 105 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], <<<'JSON'
128 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))), 106 {
129 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(' 107 "status": 1,
130 { 108 "list": {
131 "status": 1, 109 "229279689": {
132 "list": { 110 "item_id": "229279689",
133 "229279689": { 111 "resolved_id": "229279689",
134 "item_id": "229279689", 112 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
135 "resolved_id": "229279689", 113 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
136 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", 114 "favorite": "1",
137 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 115 "status": "1",
138 "favorite": "1", 116 "time_added": "1473020899",
139 "status": "1", 117 "time_updated": "1473020899",
140 "time_added": "1473020899", 118 "time_read": "0",
141 "time_updated": "1473020899", 119 "time_favorited": "0",
142 "time_read": "0", 120 "sort_id": 0,
143 "time_favorited": "0", 121 "resolved_title": "The Massive Ryder Cup Preview",
144 "sort_id": 0, 122 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
145 "resolved_title": "The Massive Ryder Cup Preview", 123 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
146 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", 124 "is_article": "1",
147 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", 125 "is_index": "0",
148 "is_article": "1", 126 "has_video": "1",
149 "is_index": "0", 127 "has_image": "1",
150 "has_video": "1", 128 "word_count": "3197",
151 "has_image": "1", 129 "images": {
152 "word_count": "3197", 130 "1": {
153 "images": { 131 "item_id": "229279689",
154 "1": { 132 "image_id": "1",
155 "item_id": "229279689", 133 "src": "http://a.espncdn.com/combiner/i?img=/photo/2012/0927/grant_g_ryder_cr_640.jpg&w=640&h=360",
156 "image_id": "1", 134 "width": "0",
157 "src": "http://a.espncdn.com/combiner/i?img=/photo/2012/0927/grant_g_ryder_cr_640.jpg&w=640&h=360", 135 "height": "0",
158 "width": "0", 136 "credit": "Jamie Squire/Getty Images",
159 "height": "0", 137 "caption": ""
160 "credit": "Jamie Squire/Getty Images", 138 }
161 "caption": "" 139 },
162 } 140 "videos": {
163 }, 141 "1": {
164 "videos": { 142 "item_id": "229279689",
165 "1": { 143 "video_id": "1",
166 "item_id": "229279689", 144 "src": "http://www.youtube.com/v/Er34PbFkVGk?version=3&hl=en_US&rel=0",
167 "video_id": "1", 145 "width": "420",
168 "src": "http://www.youtube.com/v/Er34PbFkVGk?version=3&hl=en_US&rel=0", 146 "height": "315",
169 "width": "420", 147 "type": "1",
170 "height": "315", 148 "vid": "Er34PbFkVGk"
171 "type": "1",
172 "vid": "Er34PbFkVGk"
173 }
174 },
175 "tags": {
176 "grantland": {
177 "item_id": "1147652870",
178 "tag": "grantland"
179 },
180 "Ryder Cup": {
181 "item_id": "1147652870",
182 "tag": "Ryder Cup"
183 }
184 } 149 }
185 }, 150 },
186 "229279690": { 151 "tags": {
187 "item_id": "229279689", 152 "grantland": {
188 "resolved_id": "229279689", 153 "item_id": "1147652870",
189 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", 154 "tag": "grantland"
190 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 155 },
191 "favorite": "1", 156 "Ryder Cup": {
192 "status": "1", 157 "item_id": "1147652870",
193 "time_added": "1473020899", 158 "tag": "Ryder Cup"
194 "time_updated": "1473020899", 159 }
195 "time_read": "0",
196 "time_favorited": "0",
197 "sort_id": 1,
198 "resolved_title": "The Massive Ryder Cup Preview",
199 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
200 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
201 "is_article": "1",
202 "is_index": "0",
203 "has_video": "0",
204 "has_image": "0",
205 "word_count": "3197"
206 } 160 }
161 },
162 "229279690": {
163 "item_id": "229279689",
164 "resolved_id": "229279689",
165 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
166 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
167 "favorite": "1",
168 "status": "1",
169 "time_added": "1473020899",
170 "time_updated": "1473020899",
171 "time_read": "0",
172 "time_favorited": "0",
173 "sort_id": 1,
174 "resolved_title": "The Massive Ryder Cup Preview",
175 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
176 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
177 "is_article": "1",
178 "is_index": "0",
179 "has_video": "0",
180 "has_image": "0",
181 "word_count": "3197"
207 } 182 }
208 } 183 }
209 ')), 184 }
210 ]); 185JSON
211 186));
212 $client->getEmitter()->attach($mock);
213 187
214 $pocketImport = $this->getPocketImport('ConsumerKey', 1); 188 $pocketImport = $this->getPocketImport('ConsumerKey', 1);
215 189
@@ -226,6 +200,13 @@ class PocketImportTest extends TestCase
226 ->method('getRepository') 200 ->method('getRepository')
227 ->willReturn($entryRepo); 201 ->willReturn($entryRepo);
228 202
203 $this->em
204 ->expects($this->any())
205 ->method('persist')
206 ->with($this->callback(function ($persistedEntry) {
207 return $persistedEntry->isArchived() && $persistedEntry->isStarred();
208 }));
209
229 $entry = new Entry($this->user); 210 $entry = new Entry($this->user);
230 211
231 $this->contentProxy 212 $this->contentProxy
@@ -233,7 +214,7 @@ class PocketImportTest extends TestCase
233 ->method('updateEntry') 214 ->method('updateEntry')
234 ->willReturn($entry); 215 ->willReturn($entry);
235 216
236 $pocketImport->setClient($client); 217 $pocketImport->setClient($httpMockClient);
237 $pocketImport->authorize('wunderbar_code'); 218 $pocketImport->authorize('wunderbar_code');
238 219
239 $res = $pocketImport->import(); 220 $res = $pocketImport->import();
@@ -247,56 +228,52 @@ class PocketImportTest extends TestCase
247 */ 228 */
248 public function testImportAndMarkAllAsRead() 229 public function testImportAndMarkAllAsRead()
249 { 230 {
250 $client = new Client(); 231 $httpMockClient = new HttpMockClient();
251 232 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode(['access_token' => 'wunderbar_token'])));
252 $mock = new Mock([ 233 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], <<<'JSON'
253 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))), 234 {
254 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(' 235 "status": 1,
255 { 236 "list": {
256 "status": 1, 237 "229279689": {
257 "list": { 238 "item_id": "229279689",
258 "229279689": { 239 "resolved_id": "229279689",
259 "item_id": "229279689", 240 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
260 "resolved_id": "229279689", 241 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
261 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", 242 "favorite": "1",
262 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 243 "status": "1",
263 "favorite": "1", 244 "time_added": "1473020899",
264 "status": "1", 245 "time_updated": "1473020899",
265 "time_added": "1473020899", 246 "time_read": "0",
266 "time_updated": "1473020899", 247 "time_favorited": "0",
267 "time_read": "0", 248 "sort_id": 0,
268 "time_favorited": "0", 249 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
269 "sort_id": 0, 250 "is_article": "1",
270 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", 251 "has_video": "1",
271 "is_article": "1", 252 "has_image": "1",
272 "has_video": "1", 253 "word_count": "3197"
273 "has_image": "1", 254 },
274 "word_count": "3197" 255 "229279690": {
275 }, 256 "item_id": "229279689",
276 "229279690": { 257 "resolved_id": "229279689",
277 "item_id": "229279689", 258 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview/2",
278 "resolved_id": "229279689", 259 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
279 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview/2", 260 "favorite": "1",
280 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 261 "status": "0",
281 "favorite": "1", 262 "time_added": "1473020899",
282 "status": "0", 263 "time_updated": "1473020899",
283 "time_added": "1473020899", 264 "time_read": "0",
284 "time_updated": "1473020899", 265 "time_favorited": "0",
285 "time_read": "0", 266 "sort_id": 1,
286 "time_favorited": "0", 267 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
287 "sort_id": 1, 268 "is_article": "1",
288 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", 269 "has_video": "0",
289 "is_article": "1", 270 "has_image": "0",
290 "has_video": "0", 271 "word_count": "3197"
291 "has_image": "0",
292 "word_count": "3197"
293 }
294 } 272 }
295 } 273 }
296 ')), 274 }
297 ]); 275JSON
298 276));
299 $client->getEmitter()->attach($mock);
300 277
301 $pocketImport = $this->getPocketImport('ConsumerKey', 2); 278 $pocketImport = $this->getPocketImport('ConsumerKey', 2);
302 279
@@ -328,7 +305,7 @@ class PocketImportTest extends TestCase
328 ->method('updateEntry') 305 ->method('updateEntry')
329 ->willReturn($entry); 306 ->willReturn($entry);
330 307
331 $pocketImport->setClient($client); 308 $pocketImport->setClient($httpMockClient);
332 $pocketImport->authorize('wunderbar_code'); 309 $pocketImport->authorize('wunderbar_code');
333 310
334 $res = $pocketImport->setMarkAsRead(true)->import(); 311 $res = $pocketImport->setMarkAsRead(true)->import();
@@ -342,7 +319,7 @@ class PocketImportTest extends TestCase
342 */ 319 */
343 public function testImportWithRabbit() 320 public function testImportWithRabbit()
344 { 321 {
345 $client = new Client(); 322 $httpMockClient = new HttpMockClient();
346 323
347 $body = <<<'JSON' 324 $body = <<<'JSON'
348{ 325{
@@ -367,19 +344,16 @@ class PocketImportTest extends TestCase
367} 344}
368JSON; 345JSON;
369 346
370 $mock = new Mock([ 347 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode(['access_token' => 'wunderbar_token'])));
371 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))), 348 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], <<<JSON
372 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(' 349 {
373 { 350 "status": 1,
374 "status": 1, 351 "list": {
375 "list": { 352 "229279690": $body
376 "229279690": ' . $body . '
377 }
378 } 353 }
379 ')), 354 }
380 ]); 355JSON
381 356 ));
382 $client->getEmitter()->attach($mock);
383 357
384 $pocketImport = $this->getPocketImport(); 358 $pocketImport = $this->getPocketImport();
385 359
@@ -413,7 +387,7 @@ JSON;
413 ->method('publish') 387 ->method('publish')
414 ->with(json_encode($bodyAsArray)); 388 ->with(json_encode($bodyAsArray));
415 389
416 $pocketImport->setClient($client); 390 $pocketImport->setClient($httpMockClient);
417 $pocketImport->setProducer($producer); 391 $pocketImport->setProducer($producer);
418 $pocketImport->authorize('wunderbar_code'); 392 $pocketImport->authorize('wunderbar_code');
419 393
@@ -428,7 +402,7 @@ JSON;
428 */ 402 */
429 public function testImportWithRedis() 403 public function testImportWithRedis()
430 { 404 {
431 $client = new Client(); 405 $httpMockClient = new HttpMockClient();
432 406
433 $body = <<<'JSON' 407 $body = <<<'JSON'
434{ 408{
@@ -453,19 +427,16 @@ JSON;
453} 427}
454JSON; 428JSON;
455 429
456 $mock = new Mock([ 430 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode(['access_token' => 'wunderbar_token'])));
457 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))), 431 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], <<<JSON
458 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(' 432 {
459 { 433 "status": 1,
460 "status": 1, 434 "list": {
461 "list": { 435 "229279690": $body
462 "229279690": ' . $body . '
463 }
464 } 436 }
465 ')), 437 }
466 ]); 438JSON
467 439 ));
468 $client->getEmitter()->attach($mock);
469 440
470 $pocketImport = $this->getPocketImport(); 441 $pocketImport = $this->getPocketImport();
471 442
@@ -492,7 +463,7 @@ JSON;
492 $queue = new RedisQueue($redisMock, 'pocket'); 463 $queue = new RedisQueue($redisMock, 'pocket');
493 $producer = new Producer($queue); 464 $producer = new Producer($queue);
494 465
495 $pocketImport->setClient($client); 466 $pocketImport->setClient($httpMockClient);
496 $pocketImport->setProducer($producer); 467 $pocketImport->setProducer($producer);
497 $pocketImport->authorize('wunderbar_code'); 468 $pocketImport->authorize('wunderbar_code');
498 469
@@ -506,17 +477,13 @@ JSON;
506 477
507 public function testImportBadResponse() 478 public function testImportBadResponse()
508 { 479 {
509 $client = new Client(); 480 $httpMockClient = new HttpMockClient();
510 481
511 $mock = new Mock([ 482 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode(['access_token' => 'wunderbar_token'])));
512 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))), 483 $httpMockClient->addResponse(new Response(403));
513 new Response(403),
514 ]);
515
516 $client->getEmitter()->attach($mock);
517 484
518 $pocketImport = $this->getPocketImport(); 485 $pocketImport = $this->getPocketImport();
519 $pocketImport->setClient($client); 486 $pocketImport->setClient($httpMockClient);
520 $pocketImport->authorize('wunderbar_code'); 487 $pocketImport->authorize('wunderbar_code');
521 488
522 $res = $pocketImport->import(); 489 $res = $pocketImport->import();
@@ -530,25 +497,23 @@ JSON;
530 497
531 public function testImportWithExceptionFromGraby() 498 public function testImportWithExceptionFromGraby()
532 { 499 {
533 $client = new Client(); 500 $httpMockClient = new HttpMockClient();
534 501
535 $mock = new Mock([ 502 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode(['access_token' => 'wunderbar_token'])));
536 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))), 503 $httpMockClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], <<<'JSON'
537 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(' 504 {
538 { 505 "status": 1,
539 "status": 1, 506 "list": {
540 "list": { 507 "229279689": {
541 "229279689": { 508 "status": "1",
542 "status": "1", 509 "favorite": "1",
543 "favorite": "1", 510 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview"
544 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview"
545 }
546 } 511 }
547 } 512 }
548 ')), 513 }
549 ]); 514
550 515JSON
551 $client->getEmitter()->attach($mock); 516 ));
552 517
553 $pocketImport = $this->getPocketImport('ConsumerKey', 1); 518 $pocketImport = $this->getPocketImport('ConsumerKey', 1);
554 519
@@ -572,7 +537,7 @@ JSON;
572 ->method('updateEntry') 537 ->method('updateEntry')
573 ->will($this->throwException(new \Exception())); 538 ->will($this->throwException(new \Exception()));
574 539
575 $pocketImport->setClient($client); 540 $pocketImport->setClient($httpMockClient);
576 $pocketImport->authorize('wunderbar_code'); 541 $pocketImport->authorize('wunderbar_code');
577 542
578 $res = $pocketImport->import(); 543 $res = $pocketImport->import();
diff --git a/tests/Wallabag/ImportBundle/fixtures/elcurator.json b/tests/Wallabag/ImportBundle/fixtures/elcurator.json
new file mode 100644
index 00000000..f6fb2dfb
--- /dev/null
+++ b/tests/Wallabag/ImportBundle/fixtures/elcurator.json
@@ -0,0 +1,13 @@
1[
2 {
3 "created_at": "2015-09-09 11:10:32 UTC",
4 "title": "Qualité de code - Intégration de php-git-hooks dans Symfony2 - Experts Symfony et Drupal - Lexik",
5 "url": "https://devblog.lexik.fr/git/qualite-de-code-integration-de-php-git-hooks-dans-symfony2-2842",
6 "description": null,
7 "tags": [
8 "tag1",
9 "tag2"
10 ],
11 "is_saved": true
12 }
13]