From 7230e4c39f84e5aca97f439953adfd265b8d9ba4 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 11 Sep 2016 18:19:41 +0200 Subject: Enable Redis on Travis Add generated files from `composer up` Add more articles for Readability tests --- .../ImportBundle/Import/ReadabilityImportTest.php | 20 +-- .../ImportBundle/fixtures/readability.json | 167 ++++++++++++++++++++- 2 files changed, 169 insertions(+), 18 deletions(-) (limited to 'tests/Wallabag') diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php index 0981eedb..67917154 100644 --- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php @@ -61,9 +61,9 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $entryRepo->expects($this->exactly(2)) + $entryRepo->expects($this->exactly(24)) ->method('findByUrlAndUserId') - ->will($this->onConsecutiveCalls(false, true)); + ->willReturn(false); $this->em ->expects($this->any()) @@ -75,14 +75,14 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase ->getMock(); $this->contentProxy - ->expects($this->exactly(1)) + ->expects($this->exactly(24)) ->method('updateEntry') ->willReturn($entry); $res = $readabilityImport->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 1, 'imported' => 1], $readabilityImport->getSummary()); + $this->assertEquals(['skipped' => 0, 'imported' => 24], $readabilityImport->getSummary()); } public function testImportAndMarkAllAsRead() @@ -96,7 +96,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $entryRepo->expects($this->exactly(2)) ->method('findByUrlAndUserId') - ->will($this->onConsecutiveCalls(false, false)); + ->will($this->onConsecutiveCalls(false, true)); $this->em ->expects($this->any()) @@ -104,7 +104,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase ->willReturn($entryRepo); $this->contentProxy - ->expects($this->exactly(2)) + ->expects($this->exactly(1)) ->method('updateEntry') ->willReturn(new Entry($this->user)); @@ -120,7 +120,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary()); + $this->assertEquals(['skipped' => 1, 'imported' => 1], $readabilityImport->getSummary()); } public function testImportWithRabbit() @@ -152,7 +152,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase ->getMock(); $producer - ->expects($this->exactly(2)) + ->expects($this->exactly(24)) ->method('publish'); $readabilityImport->setProducer($producer); @@ -160,7 +160,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $res = $readabilityImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary()); + $this->assertEquals(['skipped' => 0, 'imported' => 24], $readabilityImport->getSummary()); } public function testImportWithRedis() @@ -198,7 +198,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase $res = $readabilityImport->setMarkAsRead(true)->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary()); + $this->assertEquals(['skipped' => 0, 'imported' => 24], $readabilityImport->getSummary()); $this->assertNotEmpty($redisMock->lpop('readability')); } diff --git a/tests/Wallabag/ImportBundle/fixtures/readability.json b/tests/Wallabag/ImportBundle/fixtures/readability.json index 34379905..32f6fa53 100644 --- a/tests/Wallabag/ImportBundle/fixtures/readability.json +++ b/tests/Wallabag/ImportBundle/fixtures/readability.json @@ -11,14 +11,165 @@ "archive": false }, { - "article__excerpt": "TL;DR: Re-use your DOM elements and remove the ones that are far away from the viewport. Use placeholders to account for delayed data. Here’s a demo and the code for the infinite…", - "favorite": false, - "date_archived": "2016-08-26T12:21:54", - "article__url": "https://developers.google.com/web/updates/2016/07/infinite-scroller?imm_mid=0e6839&cmp=em-webops-na-na-newsltr_20160805", - "date_added": "2016-08-06T05:35:26", - "date_favorited": null, - "article__title": "Complexities of an infinite scroller | Web Updates", - "archive": true + "article__title": "Réfugiés: l'UE va créer 100 000 places d'accueil dans les Balkans", + "article__url": "http://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867", + "archive": false, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": false + }, + { + "article__title": "No title found", + "article__url": "http://news.nationalgeographic.com/2016/02/160211-albatrosses-mothers-babies-animals-science/&sf20739758=1", + "archive": false, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": true + }, + { + "archive": 0, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Échecs", + "article__url": "https://fr.wikipedia.org/wiki/Échecs" + }, + { + "archive": 0, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "90% des dossiers médicaux des Coréens du sud vendus à des entreprises privées - ZATAZ", + "article__url": "http://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/" + }, + { + "archive": 0, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Mass Surveillance As Art", + "article__url": "https://www.nationaljournal.com/s/73311/mass-surveillance-art" + }, + { + "archive": 0, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "What David Cameron did to the pig, his party is now doing to the country", + "article__url": "http://www.newstatesman.com/2015/09/what-david-cameron-did-pig-his-party-now-doing-country" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "CLICK HERE to support 2016 CES Winner, Revolutionary Auto-Tracking Robot", + "article__url": "https://www.indiegogo.com/projects/2016-ces-winner-revolutionary-auto-tracking-robot" + }, + { + "archive": 0, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 1, + "article__title": "No title found", + "article__url": "http://carnetdevol.shost.ca/wordpress/aide-memoire-sur-les-commandes-associees-a-systemd/" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Présentation d'Arduino - Tuto Arduino - Le blog d'Eskimon", + "article__url": "http://eskimon.fr/73-arduino-101-presentation" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Lenovo ThinkPad X1 Carbon Ultrabook Review", + "article__url": "http://www.notebookcheck.net/Lenovo-ThinkPad-X1-Carbon-Ultrabook-Review.138033.0.html" + }, + { + "archive": 0, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Visitons le Château de Landsberg !", + "article__url": "http://autour-du-mont-sainte-odile.overblog.com/2016/01/visitons-le-chateau-de-landsberg.html" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Contrer les stéréotypes par les livres : “C'est dès l'enfance qu'ils se construisent”", + "article__url": "https://www.actualitte.com/article/monde-edition/contrer-les-stereotypes-par-les-livres-c-est-des-l-enfance-qu-ils-se-construisent/64058" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "[ROM][6.0.1][Layers][N5] TipsyOS official builds {UBER TCs}", + "article__url": "http://forum.xda-developers.com/google-nexus-5/development/rom-tipsyos-official-builds-uber-tcs-t3325989" + }, + { + "archive": 0, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Top 15 Podcasts All Web Developers Should Follow - Envato Tuts+ Code Article", + "article__url": "http://code.tutsplus.com/articles/top-15-podcasts-all-web-developers-should-follow--net-14461" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "University of Mississippi", + "article__url": "http://olemiss.edu" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "FinnChristiansen.de Jetzt Dank Let’s Encrypt Per HTTPS Erreichbar", + "article__url": "https://www.finnchristiansen.de/2015/12/06/finnchristiansen-de-jetzt-dank-lets-encrypt-per-https-erreichbar/" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Le développeur et l'ingénierie logicielle", + "article__url": "http://wemucs.com/le-developpeur-et-lingenierie-logicielle/" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "The Role of Methylation in Gene Expression", + "article__url": "http://www.nature.com/scitable/topicpage/the-role-of-methylation-in-gene-expression-1070" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "E-Mail-Adresse kostenlos, FreeMail, De-Mail & Nachrichten", + "article__url": "http://web.de" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "OpenSSH Server on Arch Linux | DominicM test", + "article__url": "http://dominicm.com/openssh-server-arch-linux/" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Site Moved | Site Help", + "article__url": "http://g1.com/help/sitemoved.asp" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "#Maroc : le stylo anti-pédophiles EAGLE d’AMESYS est moins bien configuré que les faux-lowers Twitter du roi Mohammed VI", + "article__url": "https://reflets.info/maroc-le-stylo-anti-pedophiles-eagle-damesys-est-moins-bien-configure-que-les-faux-lowers-twitter-du-roi-mohammed-vi/" + }, + { + "archive": 1, + "date_added": "2016-09-08T11:55:58+0200", + "favorite": 0, + "article__title": "Simple Cloud Infrastructure for Developers", + "article__url": "https://www.digitalocean.com/" } ], "recommendations": [] -- cgit v1.2.3