aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php6
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php6
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php14
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/readability.json7
5 files changed, 20 insertions, 21 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index bf7d373a..1b0c06d2 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -342,6 +342,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
342 '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', 342 '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',
343 'tags' => 'google', 343 'tags' => 'google',
344 'title' => 'New title for my article', 344 'title' => 'New title for my article',
345 'content' => 'my content',
346 'language' => 'de_DE',
347 'published_at' => '2016-09-08T11:55:58+0200',
345 ]); 348 ]);
346 349
347 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 350 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -355,6 +358,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
355 $this->assertEquals('New title for my article', $content['title']); 358 $this->assertEquals('New title for my article', $content['title']);
356 $this->assertEquals(1, $content['user_id']); 359 $this->assertEquals(1, $content['user_id']);
357 $this->assertCount(2, $content['tags']); 360 $this->assertCount(2, $content['tags']);
361 $this->assertSame('my content', $content['content']);
362 $this->assertSame('de_DE', $content['language']);
363 $this->assertSame('2016-09-08T11:55:58+0200', $content['published_at']);
358 } 364 }
359 365
360 public function testPostSameEntry() 366 public function testPostSameEntry()
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index 4ca6e623..2c492c20 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -112,16 +112,16 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
112 ->get('doctrine.orm.entity_manager') 112 ->get('doctrine.orm.entity_manager')
113 ->getRepository('WallabagCoreBundle:Entry') 113 ->getRepository('WallabagCoreBundle:Entry')
114 ->findByUrlAndUserId( 114 ->findByUrlAndUserId(
115 'https://framablog.org/2014/02/05/framabag-service-libre-gratuit-interview-developpeur/', 115 'http://www.framablog.org/index.php/post/2014/02/05/Framabag-service-libre-gratuit-interview-developpeur',
116 $this->getLoggedInUserId() 116 $this->getLoggedInUserId()
117 ); 117 );
118 118
119 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); 119 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
120 $this->assertContains('flashes.import.notice.summary', $body[0]); 120 $this->assertContains('flashes.import.notice.summary', $body[0]);
121 121
122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok'); 122 $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is empty');
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); 123 $this->assertEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is empty');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); 124 $this->assertEmpty($content->getLanguage(), 'Language for http://www.framablog.org is empty');
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');
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
index 18a02522..9df827ea 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -119,9 +119,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
119 $this->getLoggedInUserId() 119 $this->getLoggedInUserId()
120 ); 120 );
121 121
122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); 122 $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is empty');
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 123 $this->assertEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is empty');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 124 $this->assertEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is empty');
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');
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
index 254f0a25..25eedd1b 100644
--- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
@@ -67,14 +67,14 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
67 67
68 public function testImport() 68 public function testImport()
69 { 69 {
70 $readabilityImport = $this->getReadabilityImport(false, 24); 70 $readabilityImport = $this->getReadabilityImport(false, 23);
71 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); 71 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json');
72 72
73 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 73 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
74 ->disableOriginalConstructor() 74 ->disableOriginalConstructor()
75 ->getMock(); 75 ->getMock();
76 76
77 $entryRepo->expects($this->exactly(24)) 77 $entryRepo->expects($this->exactly(23))
78 ->method('findByUrlAndUserId') 78 ->method('findByUrlAndUserId')
79 ->willReturn(false); 79 ->willReturn(false);
80 80
@@ -88,14 +88,14 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
88 ->getMock(); 88 ->getMock();
89 89
90 $this->contentProxy 90 $this->contentProxy
91 ->expects($this->exactly(24)) 91 ->expects($this->exactly(23))
92 ->method('updateEntry') 92 ->method('updateEntry')
93 ->willReturn($entry); 93 ->willReturn($entry);
94 94
95 $res = $readabilityImport->import(); 95 $res = $readabilityImport->import();
96 96
97 $this->assertTrue($res); 97 $this->assertTrue($res);
98 $this->assertEquals(['skipped' => 0, 'imported' => 24, 'queued' => 0], $readabilityImport->getSummary()); 98 $this->assertEquals(['skipped' => 0, 'imported' => 23, 'queued' => 0], $readabilityImport->getSummary());
99 } 99 }
100 100
101 public function testImportAndMarkAllAsRead() 101 public function testImportAndMarkAllAsRead()
@@ -165,7 +165,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
165 ->getMock(); 165 ->getMock();
166 166
167 $producer 167 $producer
168 ->expects($this->exactly(24)) 168 ->expects($this->exactly(23))
169 ->method('publish'); 169 ->method('publish');
170 170
171 $readabilityImport->setProducer($producer); 171 $readabilityImport->setProducer($producer);
@@ -173,7 +173,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
173 $res = $readabilityImport->setMarkAsRead(true)->import(); 173 $res = $readabilityImport->setMarkAsRead(true)->import();
174 174
175 $this->assertTrue($res); 175 $this->assertTrue($res);
176 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $readabilityImport->getSummary()); 176 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 23], $readabilityImport->getSummary());
177 } 177 }
178 178
179 public function testImportWithRedis() 179 public function testImportWithRedis()
@@ -211,7 +211,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
211 $res = $readabilityImport->setMarkAsRead(true)->import(); 211 $res = $readabilityImport->setMarkAsRead(true)->import();
212 212
213 $this->assertTrue($res); 213 $this->assertTrue($res);
214 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $readabilityImport->getSummary()); 214 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 23], $readabilityImport->getSummary());
215 215
216 $this->assertNotEmpty($redisMock->lpop('readability')); 216 $this->assertNotEmpty($redisMock->lpop('readability'));
217 } 217 }
diff --git a/tests/Wallabag/ImportBundle/fixtures/readability.json b/tests/Wallabag/ImportBundle/fixtures/readability.json
index 32f6fa53..88b66c46 100644
--- a/tests/Wallabag/ImportBundle/fixtures/readability.json
+++ b/tests/Wallabag/ImportBundle/fixtures/readability.json
@@ -11,13 +11,6 @@
11 "archive": false 11 "archive": false
12 }, 12 },
13 { 13 {
14 "article__title": "Réfugiés: l'UE va créer 100 000 places d'accueil dans les Balkans",
15 "article__url": "http://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867",
16 "archive": false,
17 "date_added": "2016-09-08T11:55:58+0200",
18 "favorite": false
19 },
20 {
21 "article__title": "No title found", 14 "article__title": "No title found",
22 "article__url": "http://news.nationalgeographic.com/2016/02/160211-albatrosses-mothers-babies-animals-science/&sf20739758=1", 15 "article__url": "http://news.nationalgeographic.com/2016/02/160211-albatrosses-mothers-babies-animals-science/&sf20739758=1",
23 "archive": false, 16 "archive": false,