aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php34
-rw-r--r--tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php63
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php212
-rw-r--r--tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php63
-rw-r--r--tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php185
-rw-r--r--tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php10
-rw-r--r--tests/Wallabag/ApiBundle/WallabagApiTestCase.php6
-rw-r--r--tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php108
-rw-r--r--tests/Wallabag/CoreBundle/Command/ExportCommandTest.php6
-rw-r--r--tests/Wallabag/CoreBundle/Command/InstallCommandTest.php185
-rw-r--r--tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php93
-rw-r--r--tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php91
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php582
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php4
-rw-r--r--tests/Wallabag/CoreBundle/Controller/RssControllerTest.php43
-rw-r--r--tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php139
-rw-r--r--tests/Wallabag/CoreBundle/Controller/TagControllerTest.php59
-rw-r--r--tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php97
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php373
-rw-r--r--tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php40
-rw-r--r--tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php49
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RedirectTest.php18
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php27
-rw-r--r--tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php108
-rw-r--r--tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/WallabagCoreTestCase.php76
-rw-r--r--tests/Wallabag/CoreBundle/fixtures/image-no-content-type.jpgbin0 -> 354067 bytes
-rw-r--r--tests/Wallabag/ImportBundle/Command/ImportCommandTest.php32
-rw-r--r--tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php10
-rw-r--r--tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php22
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php6
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php22
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php21
-rw-r--r--tests/Wallabag/ImportBundle/Import/ChromeImportTest.php7
-rw-r--r--tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php7
-rw-r--r--tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php42
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php21
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php31
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php22
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv1
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/pinboard_export4
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/readability.json147
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/wallabag-v1.json33
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json296
-rw-r--r--tests/Wallabag/UserBundle/Controller/ManageControllerTest.php30
-rw-r--r--tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php66
51 files changed, 2438 insertions, 1079 deletions
diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
index 81f9e9ec..3c94382c 100644
--- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
+++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
@@ -84,7 +84,9 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
84 $content = json_encode([ 84 $content = json_encode([
85 'text' => 'my annotation', 85 'text' => 'my annotation',
86 'quote' => 'my quote', 86 'quote' => 'my quote',
87 'ranges' => ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], 87 'ranges' => [
88 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31],
89 ],
88 ]); 90 ]);
89 $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); 91 $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content);
90 92
@@ -107,6 +109,36 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
107 } 109 }
108 110
109 /** 111 /**
112 * @dataProvider dataForEachAnnotations
113 */
114 public function testSetAnnotationWithQuoteTooLong($prefixUrl)
115 {
116 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
117
118 if ('annotations' === $prefixUrl) {
119 $this->logInAs('admin');
120 }
121
122 /** @var Entry $entry */
123 $entry = $em
124 ->getRepository('WallabagCoreBundle:Entry')
125 ->findOneByUsernameAndNotArchived('admin');
126
127 $longQuote = str_repeat('a', 10001);
128 $headers = ['CONTENT_TYPE' => 'application/json'];
129 $content = json_encode([
130 'text' => 'my annotation',
131 'quote' => $longQuote,
132 'ranges' => [
133 ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31],
134 ],
135 ]);
136 $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content);
137
138 $this->assertEquals(400, $this->client->getResponse()->getStatusCode());
139 }
140
141 /**
110 * Test editing an existing annotation. 142 * Test editing an existing annotation.
111 * 143 *
112 * @dataProvider dataForEachAnnotations 144 * @dataProvider dataForEachAnnotations
diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
index 6659443b..53aed12b 100644
--- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
@@ -3,6 +3,7 @@
3namespace Tests\Wallabag\ApiBundle\Controller; 3namespace Tests\Wallabag\ApiBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Wallabag\ApiBundle\Entity\Client;
6 7
7class DeveloperControllerTest extends WallabagCoreTestCase 8class DeveloperControllerTest extends WallabagCoreTestCase
8{ 9{
@@ -33,14 +34,10 @@ class DeveloperControllerTest extends WallabagCoreTestCase
33 $this->assertContains('My app', $alert[0]); 34 $this->assertContains('My app', $alert[0]);
34 } 35 }
35 36
36 /** 37 public function testCreateTokenFromPasswords()
37 * @depends testCreateClient
38 */
39 public function testCreateToken()
40 { 38 {
41 $client = $this->getClient(); 39 $client = $this->getClient();
42 $em = $client->getContainer()->get('doctrine.orm.entity_manager'); 40 $apiClient = $this->createApiClientForUser('admin');
43 $apiClient = $em->getRepository('WallabagApiBundle:Client')->findOneByName('My app');
44 41
45 $client->request('POST', '/oauth/v2/token', [ 42 $client->request('POST', '/oauth/v2/token', [
46 'grant_type' => 'password', 43 'grant_type' => 'password',
@@ -59,6 +56,26 @@ class DeveloperControllerTest extends WallabagCoreTestCase
59 $this->assertArrayHasKey('refresh_token', $data); 56 $this->assertArrayHasKey('refresh_token', $data);
60 } 57 }
61 58
59 public function testCreateTokenFromClientCredentialsOnly()
60 {
61 $client = $this->getClient();
62 $apiClient = $this->createApiClientForUser('admin', ['client_credentials']);
63
64 $client->request('POST', '/oauth/v2/token', [
65 'grant_type' => 'client_credentials',
66 'client_id' => $apiClient->getPublicId(),
67 'client_secret' => $apiClient->getSecret(),
68 ]);
69
70 $this->assertEquals(200, $client->getResponse()->getStatusCode());
71
72 $data = json_decode($client->getResponse()->getContent(), true);
73 $this->assertArrayHasKey('access_token', $data);
74 $this->assertArrayHasKey('expires_in', $data);
75 $this->assertArrayHasKey('token_type', $data);
76 // Client Credentials created-clients have no refresh tokens
77 }
78
62 public function testListingClient() 79 public function testListingClient()
63 { 80 {
64 $this->logInAs('admin'); 81 $this->logInAs('admin');
@@ -83,6 +100,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
83 public function testRemoveClient() 100 public function testRemoveClient()
84 { 101 {
85 $client = $this->getClient(); 102 $client = $this->getClient();
103 $adminApiClient = $this->createApiClientForUser('admin');
86 $em = $client->getContainer()->get('doctrine.orm.entity_manager'); 104 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
87 105
88 // Try to remove an admin's client with a wrong user 106 // Try to remove an admin's client with a wrong user
@@ -90,12 +108,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase
90 $client->request('GET', '/developer'); 108 $client->request('GET', '/developer');
91 $this->assertContains('no_client', $client->getResponse()->getContent()); 109 $this->assertContains('no_client', $client->getResponse()->getContent());
92 110
93 // get an ID of a admin's client
94 $this->logInAs('admin');
95 $nbClients = $em->getRepository('WallabagApiBundle:Client')->findByUser($this->getLoggedInUserId());
96
97 $this->logInAs('bob'); 111 $this->logInAs('bob');
98 $client->request('GET', '/developer/client/delete/'.$nbClients[0]->getId()); 112 $client->request('GET', '/developer/client/delete/'.$adminApiClient->getId());
99 $this->assertEquals(403, $client->getResponse()->getStatusCode()); 113 $this->assertEquals(403, $client->getResponse()->getStatusCode());
100 114
101 // Try to remove the admin's client with the good user 115 // Try to remove the admin's client with the good user
@@ -111,7 +125,30 @@ class DeveloperControllerTest extends WallabagCoreTestCase
111 $client->click($link); 125 $client->click($link);
112 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 126 $this->assertEquals(302, $client->getResponse()->getStatusCode());
113 127
114 $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findByUser($this->getLoggedInUserId()); 128 $this->assertNull(
115 $this->assertGreaterThan(count($newNbClients), count($nbClients)); 129 $em->getRepository('WallabagApiBundle:Client')->find($adminApiClient->getId()),
130 'The client should have been removed'
131 );
132 }
133
134 /**
135 * @param string $username
136 *
137 * @param array $grantTypes
138 * @return Client
139 */
140 private function createApiClientForUser($username, $grantTypes = ['password'])
141 {
142 $client = $this->getClient();
143 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
144 $userManager = $client->getContainer()->get('fos_user.user_manager');
145 $user = $userManager->findUserBy(array('username' => $username));
146 $apiClient = new Client($user);
147 $apiClient->setName('My app');
148 $apiClient->setAllowedGrantTypes($grantTypes);
149 $em->persist($apiClient);
150 $em->flush();
151
152 return $apiClient;
116 } 153 }
117} 154}
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 0a65f9ce..067aed2c 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -3,8 +3,10 @@
3namespace Tests\Wallabag\ApiBundle\Controller; 3namespace Tests\Wallabag\ApiBundle\Controller;
4 4
5use Tests\Wallabag\ApiBundle\WallabagApiTestCase; 5use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
6use Wallabag\CoreBundle\Entity\Entry;
6use Wallabag\CoreBundle\Entity\Tag; 7use Wallabag\CoreBundle\Entity\Tag;
7use Wallabag\CoreBundle\Helper\ContentProxy; 8use Wallabag\CoreBundle\Helper\ContentProxy;
9use Wallabag\UserBundle\Entity\User;
8 10
9class EntryRestControllerTest extends WallabagApiTestCase 11class EntryRestControllerTest extends WallabagApiTestCase
10{ 12{
@@ -126,6 +128,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
126 'perPage' => 2, 128 'perPage' => 2,
127 'tags' => 'foo', 129 'tags' => 'foo',
128 'since' => 1443274283, 130 'since' => 1443274283,
131 'public' => 0,
129 ]); 132 ]);
130 133
131 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 134 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -152,6 +155,53 @@ class EntryRestControllerTest extends WallabagApiTestCase
152 $this->assertContains('order=asc', $content['_links'][$link]['href']); 155 $this->assertContains('order=asc', $content['_links'][$link]['href']);
153 $this->assertContains('tags=foo', $content['_links'][$link]['href']); 156 $this->assertContains('tags=foo', $content['_links'][$link]['href']);
154 $this->assertContains('since=1443274283', $content['_links'][$link]['href']); 157 $this->assertContains('since=1443274283', $content['_links'][$link]['href']);
158 $this->assertContains('public=0', $content['_links'][$link]['href']);
159 }
160
161 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
162 }
163
164 public function testGetEntriesPublicOnly()
165 {
166 $entry = $this->client->getContainer()
167 ->get('doctrine.orm.entity_manager')
168 ->getRepository('WallabagCoreBundle:Entry')
169 ->findOneByUser(1);
170
171 if (!$entry) {
172 $this->markTestSkipped('No content found in db.');
173 }
174
175 // generate at least one public entry
176 $entry->generateUid();
177
178 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
179 $em->persist($entry);
180 $em->flush();
181
182 $this->client->request('GET', '/api/entries', [
183 'public' => 1,
184 ]);
185
186 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
187
188 $content = json_decode($this->client->getResponse()->getContent(), true);
189
190 $this->assertGreaterThanOrEqual(1, count($content));
191 $this->assertArrayHasKey('items', $content['_embedded']);
192 $this->assertGreaterThanOrEqual(1, $content['total']);
193 $this->assertEquals(1, $content['page']);
194 $this->assertEquals(30, $content['limit']);
195 $this->assertGreaterThanOrEqual(1, $content['pages']);
196
197 $this->assertArrayHasKey('_links', $content);
198 $this->assertArrayHasKey('self', $content['_links']);
199 $this->assertArrayHasKey('first', $content['_links']);
200 $this->assertArrayHasKey('last', $content['_links']);
201
202 foreach (['self', 'first', 'last'] as $link) {
203 $this->assertArrayHasKey('href', $content['_links'][$link]);
204 $this->assertContains('public=1', $content['_links'][$link]['href']);
155 } 205 }
156 206
157 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 207 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
@@ -315,7 +365,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
315 $entry = $this->client->getContainer() 365 $entry = $this->client->getContainer()
316 ->get('doctrine.orm.entity_manager') 366 ->get('doctrine.orm.entity_manager')
317 ->getRepository('WallabagCoreBundle:Entry') 367 ->getRepository('WallabagCoreBundle:Entry')
318 ->findOneByUser(1); 368 ->findOneByUser(1, ['id' => 'asc']);
319 369
320 if (!$entry) { 370 if (!$entry) {
321 $this->markTestSkipped('No content found in db.'); 371 $this->markTestSkipped('No content found in db.');
@@ -342,6 +392,11 @@ 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', 392 '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', 393 'tags' => 'google',
344 'title' => 'New title for my article', 394 'title' => 'New title for my article',
395 'content' => 'my content',
396 'language' => 'de',
397 'published_at' => '2016-09-08T11:55:58+0200',
398 'authors' => 'bob,helen',
399 'public' => 1,
345 ]); 400 ]);
346 401
347 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 402 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -354,7 +409,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
354 $this->assertEquals(false, $content['is_starred']); 409 $this->assertEquals(false, $content['is_starred']);
355 $this->assertEquals('New title for my article', $content['title']); 410 $this->assertEquals('New title for my article', $content['title']);
356 $this->assertEquals(1, $content['user_id']); 411 $this->assertEquals(1, $content['user_id']);
357 $this->assertCount(1, $content['tags']); 412 $this->assertCount(2, $content['tags']);
413 $this->assertSame('my content', $content['content']);
414 $this->assertSame('de', $content['language']);
415 $this->assertSame('2016-09-08T11:55:58+0200', $content['published_at']);
416 $this->assertCount(2, $content['published_by']);
417 $this->assertContains('bob', $content['published_by']);
418 $this->assertContains('helen', $content['published_by']);
419 $this->assertTrue($content['is_public'], 'A public link has been generated for that entry');
358 } 420 }
359 421
360 public function testPostSameEntry() 422 public function testPostSameEntry()
@@ -373,7 +435,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
373 $this->assertEquals('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', $content['url']); 435 $this->assertEquals('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', $content['url']);
374 $this->assertEquals(true, $content['is_archived']); 436 $this->assertEquals(true, $content['is_archived']);
375 $this->assertEquals(false, $content['is_starred']); 437 $this->assertEquals(false, $content['is_starred']);
376 $this->assertCount(2, $content['tags']); 438 $this->assertCount(3, $content['tags']);
377 } 439 }
378 440
379 public function testPostEntryWhenFetchContentFails() 441 public function testPostEntryWhenFetchContentFails()
@@ -465,6 +527,11 @@ class EntryRestControllerTest extends WallabagApiTestCase
465 'tags' => 'new tag '.uniqid(), 527 'tags' => 'new tag '.uniqid(),
466 'starred' => '1', 528 'starred' => '1',
467 'archive' => '0', 529 'archive' => '0',
530 'language' => 'de_AT',
531 'preview_picture' => 'http://preview.io/picture.jpg',
532 'authors' => 'bob,sponge',
533 'content' => 'awesome',
534 'public' => 0,
468 ]); 535 ]);
469 536
470 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 537 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -476,6 +543,12 @@ class EntryRestControllerTest extends WallabagApiTestCase
476 $this->assertEquals('New awesome title', $content['title']); 543 $this->assertEquals('New awesome title', $content['title']);
477 $this->assertGreaterThan($nbTags, count($content['tags'])); 544 $this->assertGreaterThan($nbTags, count($content['tags']));
478 $this->assertEquals(1, $content['user_id']); 545 $this->assertEquals(1, $content['user_id']);
546 $this->assertEquals('de_AT', $content['language']);
547 $this->assertEquals('http://preview.io/picture.jpg', $content['preview_picture']);
548 $this->assertContains('sponge', $content['published_by']);
549 $this->assertContains('bob', $content['published_by']);
550 $this->assertEquals('awesome', $content['content']);
551 $this->assertFalse($content['is_public'], 'Entry is no more shared');
479 } 552 }
480 553
481 public function testPatchEntryWithoutQuotes() 554 public function testPatchEntryWithoutQuotes()
@@ -497,6 +570,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
497 'tags' => 'new tag '.uniqid(), 570 'tags' => 'new tag '.uniqid(),
498 'starred' => 1, 571 'starred' => 1,
499 'archive' => 0, 572 'archive' => 0,
573 'authors' => ['bob', 'sponge'],
500 ]); 574 ]);
501 575
502 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 576 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -507,6 +581,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
507 $this->assertEquals($entry->getUrl(), $content['url']); 581 $this->assertEquals($entry->getUrl(), $content['url']);
508 $this->assertEquals('New awesome title', $content['title']); 582 $this->assertEquals('New awesome title', $content['title']);
509 $this->assertGreaterThan($nbTags, count($content['tags'])); 583 $this->assertGreaterThan($nbTags, count($content['tags']));
584 $this->assertTrue(empty($content['published_by']), 'Authors were not saved because of an array instead of a string');
510 } 585 }
511 586
512 public function testGetTagsEntry() 587 public function testGetTagsEntry()
@@ -692,7 +767,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
692 767
693 $content = json_decode($this->client->getResponse()->getContent(), true); 768 $content = json_decode($this->client->getResponse()->getContent(), true);
694 769
695 $this->assertEquals(true, $content['exists']); 770 $this->assertEquals(2, $content['exists']);
696 } 771 }
697 772
698 public function testGetEntriesExistsWithManyUrls() 773 public function testGetEntriesExistsWithManyUrls()
@@ -707,7 +782,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
707 782
708 $this->assertArrayHasKey($url1, $content); 783 $this->assertArrayHasKey($url1, $content);
709 $this->assertArrayHasKey($url2, $content); 784 $this->assertArrayHasKey($url2, $content);
710 $this->assertEquals(true, $content[$url1]); 785 $this->assertEquals(2, $content[$url1]);
711 $this->assertEquals(false, $content[$url2]); 786 $this->assertEquals(false, $content[$url2]);
712 } 787 }
713 788
@@ -764,4 +839,131 @@ class EntryRestControllerTest extends WallabagApiTestCase
764 839
765 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 840 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
766 } 841 }
842
843 public function testPostEntriesTagsListAction()
844 {
845 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
846 ->getRepository('WallabagCoreBundle:Entry')
847 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
848
849 $tags = $entry->getTags();
850
851 $this->assertCount(2, $tags);
852
853 $list = [
854 [
855 'url' => 'http://0.0.0.0/entry4',
856 'tags' => 'new tag 1, new tag 2',
857 ],
858 ];
859
860 $this->client->request('POST', '/api/entries/tags/lists?list='.json_encode($list));
861
862 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
863
864 $content = json_decode($this->client->getResponse()->getContent(), true);
865
866 $this->assertInternalType('int', $content[0]['entry']);
867 $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']);
868
869 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
870 ->getRepository('WallabagCoreBundle:Entry')
871 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
872
873 $tags = $entry->getTags();
874 $this->assertCount(4, $tags);
875 }
876
877 public function testDeleteEntriesTagsListAction()
878 {
879 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
880 $entry = new Entry($em->getReference(User::class, 1));
881 $entry->setUrl('http://0.0.0.0/test-entry');
882 $entry->addTag((new Tag())->setLabel('foo-tag'));
883 $entry->addTag((new Tag())->setLabel('bar-tag'));
884 $em->persist($entry);
885 $em->flush();
886
887 $em->clear();
888
889 $list = [
890 [
891 'url' => 'http://0.0.0.0/test-entry',
892 'tags' => 'foo-tag, bar-tag',
893 ],
894 ];
895
896 $this->client->request('DELETE', '/api/entries/tags/list?list='.json_encode($list));
897 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
898
899 $entry = $em->getRepository('WallabagCoreBundle:Entry')->find($entry->getId());
900 $this->assertCount(0, $entry->getTags());
901 }
902
903 public function testPostEntriesListAction()
904 {
905 $list = [
906 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html',
907 'http://0.0.0.0/entry2',
908 ];
909
910 $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list));
911
912 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
913
914 $content = json_decode($this->client->getResponse()->getContent(), true);
915
916 $this->assertInternalType('int', $content[0]['entry']);
917 $this->assertEquals('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']);
918
919 $this->assertInternalType('int', $content[1]['entry']);
920 $this->assertEquals('http://0.0.0.0/entry2', $content[1]['url']);
921 }
922
923 public function testDeleteEntriesListAction()
924 {
925 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
926 $em->persist((new Entry($em->getReference(User::class, 1)))->setUrl('http://0.0.0.0/test-entry1'));
927
928 $em->flush();
929 $em->clear();
930 $list = [
931 'http://0.0.0.0/test-entry1',
932 'http://0.0.0.0/test-entry-not-exist',
933 ];
934
935 $this->client->request('DELETE', '/api/entries/list?urls='.json_encode($list));
936
937 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
938
939 $content = json_decode($this->client->getResponse()->getContent(), true);
940
941 $this->assertTrue($content[0]['entry']);
942 $this->assertEquals('http://0.0.0.0/test-entry1', $content[0]['url']);
943
944 $this->assertFalse($content[1]['entry']);
945 $this->assertEquals('http://0.0.0.0/test-entry-not-exist', $content[1]['url']);
946 }
947
948 public function testLimitBulkAction()
949 {
950 $list = [
951 'http://0.0.0.0/entry1',
952 'http://0.0.0.0/entry1',
953 'http://0.0.0.0/entry1',
954 'http://0.0.0.0/entry1',
955 'http://0.0.0.0/entry1',
956 'http://0.0.0.0/entry1',
957 'http://0.0.0.0/entry1',
958 'http://0.0.0.0/entry1',
959 'http://0.0.0.0/entry1',
960 'http://0.0.0.0/entry1',
961 'http://0.0.0.0/entry1',
962 ];
963
964 $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list));
965
966 $this->assertEquals(400, $this->client->getResponse()->getStatusCode());
967 $this->assertContains('API limit reached', $this->client->getResponse()->getContent());
968 }
767} 969}
diff --git a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
index bde5251f..7f69bd67 100644
--- a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
@@ -22,39 +22,49 @@ class TagRestControllerTest extends WallabagApiTestCase
22 return end($content); 22 return end($content);
23 } 23 }
24 24
25 /** 25 public function testDeleteUserTag()
26 * @depends testGetUserTags
27 */
28 public function testDeleteUserTag($tag)
29 { 26 {
30 $tagName = $tag['label']; 27 $tagLabel = 'tagtest';
28 $tag = new Tag();
29 $tag->setLabel($tagLabel);
31 30
32 $this->client->request('DELETE', '/api/tags/'.$tag['id'].'.json'); 31 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
32 $em->persist($tag);
33 $em->flush();
34 $em->clear();
35
36 $this->client->request('DELETE', '/api/tags/'.$tag->getId().'.json');
33 37
34 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 38 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
35 39
36 $content = json_decode($this->client->getResponse()->getContent(), true); 40 $content = json_decode($this->client->getResponse()->getContent(), true);
37 41
38 $this->assertArrayHasKey('label', $content); 42 $this->assertArrayHasKey('label', $content);
39 $this->assertEquals($tag['label'], $content['label']); 43 $this->assertEquals($tag->getLabel(), $content['label']);
40 $this->assertEquals($tag['slug'], $content['slug']); 44 $this->assertEquals($tag->getSlug(), $content['slug']);
41 45
42 $entries = $this->client->getContainer() 46 $entries = $em->getRepository('WallabagCoreBundle:Entry')
43 ->get('doctrine.orm.entity_manager') 47 ->findAllByTagId($this->user->getId(), $tag->getId());
44 ->getRepository('WallabagCoreBundle:Entry')
45 ->findAllByTagId($this->user->getId(), $tag['id']);
46 48
47 $this->assertCount(0, $entries); 49 $this->assertCount(0, $entries);
48 50
49 $tag = $this->client->getContainer() 51 $tag = $em->getRepository('WallabagCoreBundle:Tag')->findOneByLabel($tagLabel);
50 ->get('doctrine.orm.entity_manager') 52
51 ->getRepository('WallabagCoreBundle:Tag') 53 $this->assertNull($tag, $tagLabel.' was removed because it begun an orphan tag');
52 ->findOneByLabel($tagName); 54 }
53 55
54 $this->assertNull($tag, $tagName.' was removed because it begun an orphan tag'); 56 public function dataForDeletingTagByLabel()
57 {
58 return [
59 'by_query' => [true],
60 'by_body' => [false],
61 ];
55 } 62 }
56 63
57 public function testDeleteTagByLabel() 64 /**
65 * @dataProvider dataForDeletingTagByLabel
66 */
67 public function testDeleteTagByLabel($useQueryString)
58 { 68 {
59 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); 69 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
60 $entry = $this->client->getContainer() 70 $entry = $this->client->getContainer()
@@ -73,7 +83,11 @@ class TagRestControllerTest extends WallabagApiTestCase
73 $em->persist($entry); 83 $em->persist($entry);
74 $em->flush(); 84 $em->flush();
75 85
76 $this->client->request('DELETE', '/api/tag/label.json', ['tag' => $tag->getLabel()]); 86 if ($useQueryString) {
87 $this->client->request('DELETE', '/api/tag/label.json?tag='.$tag->getLabel());
88 } else {
89 $this->client->request('DELETE', '/api/tag/label.json', ['tag' => $tag->getLabel()]);
90 }
77 91
78 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 92 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
79 93
@@ -98,7 +112,10 @@ class TagRestControllerTest extends WallabagApiTestCase
98 $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); 112 $this->assertEquals(404, $this->client->getResponse()->getStatusCode());
99 } 113 }
100 114
101 public function testDeleteTagsByLabel() 115 /**
116 * @dataProvider dataForDeletingTagByLabel
117 */
118 public function testDeleteTagsByLabel($useQueryString)
102 { 119 {
103 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); 120 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
104 $entry = $this->client->getContainer() 121 $entry = $this->client->getContainer()
@@ -122,7 +139,11 @@ class TagRestControllerTest extends WallabagApiTestCase
122 $em->persist($entry); 139 $em->persist($entry);
123 $em->flush(); 140 $em->flush();
124 141
125 $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel().','.$tag2->getLabel()]); 142 if ($useQueryString) {
143 $this->client->request('DELETE', '/api/tags/label.json?tags='.$tag->getLabel().','.$tag2->getLabel());
144 } else {
145 $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel().','.$tag2->getLabel()]);
146 }
126 147
127 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 148 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
128 149
diff --git a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
new file mode 100644
index 00000000..4e65f130
--- /dev/null
+++ b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
@@ -0,0 +1,185 @@
1<?php
2
3namespace Tests\Wallabag\ApiBundle\Controller;
4
5use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
6
7class UserRestControllerTest extends WallabagApiTestCase
8{
9 public function testGetUser()
10 {
11 $this->client->request('GET', '/api/user.json');
12 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
13
14 $content = json_decode($this->client->getResponse()->getContent(), true);
15
16 $this->assertArrayHasKey('id', $content);
17 $this->assertArrayHasKey('email', $content);
18 $this->assertArrayHasKey('name', $content);
19 $this->assertArrayHasKey('username', $content);
20 $this->assertArrayHasKey('created_at', $content);
21 $this->assertArrayHasKey('updated_at', $content);
22
23 $this->assertEquals('bigboss@wallabag.org', $content['email']);
24 $this->assertEquals('Big boss', $content['name']);
25 $this->assertEquals('admin', $content['username']);
26
27 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
28 }
29
30 public function testGetUserWithoutAuthentication()
31 {
32 $client = static::createClient();
33 $client->request('GET', '/api/user.json');
34 $this->assertEquals(401, $client->getResponse()->getStatusCode());
35
36 $content = json_decode($client->getResponse()->getContent(), true);
37
38 $this->assertArrayHasKey('error', $content);
39 $this->assertArrayHasKey('error_description', $content);
40
41 $this->assertEquals('access_denied', $content['error']);
42
43 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));
44 }
45
46 public function testCreateNewUser()
47 {
48 $this->client->getContainer()->get('craue_config')->set('api_user_registration', 1);
49 $this->client->request('PUT', '/api/user.json', [
50 'username' => 'google',
51 'password' => 'googlegoogle',
52 'email' => 'wallabag@google.com',
53 ]);
54
55 $this->assertEquals(201, $this->client->getResponse()->getStatusCode());
56
57 $content = json_decode($this->client->getResponse()->getContent(), true);
58
59 $this->assertArrayHasKey('id', $content);
60 $this->assertArrayHasKey('email', $content);
61 $this->assertArrayHasKey('username', $content);
62 $this->assertArrayHasKey('created_at', $content);
63 $this->assertArrayHasKey('updated_at', $content);
64 $this->assertArrayHasKey('default_client', $content);
65
66 $this->assertEquals('wallabag@google.com', $content['email']);
67 $this->assertEquals('google', $content['username']);
68
69 $this->assertArrayHasKey('client_secret', $content['default_client']);
70 $this->assertArrayHasKey('client_id', $content['default_client']);
71
72 $this->assertEquals('Default client', $content['default_client']['name']);
73
74 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
75
76 $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0);
77 }
78
79 public function testCreateNewUserWithoutAuthentication()
80 {
81 // create a new client instead of using $this->client to be sure client isn't authenticated
82 $client = static::createClient();
83 $client->getContainer()->get('craue_config')->set('api_user_registration', 1);
84 $client->request('PUT', '/api/user.json', [
85 'username' => 'google',
86 'password' => 'googlegoogle',
87 'email' => 'wallabag@google.com',
88 'client_name' => 'My client name !!',
89 ]);
90
91 $this->assertEquals(201, $client->getResponse()->getStatusCode());
92
93 $content = json_decode($client->getResponse()->getContent(), true);
94
95 $this->assertArrayHasKey('id', $content);
96 $this->assertArrayHasKey('email', $content);
97 $this->assertArrayHasKey('username', $content);
98 $this->assertArrayHasKey('created_at', $content);
99 $this->assertArrayHasKey('updated_at', $content);
100 $this->assertArrayHasKey('default_client', $content);
101
102 $this->assertEquals('wallabag@google.com', $content['email']);
103 $this->assertEquals('google', $content['username']);
104
105 $this->assertArrayHasKey('client_secret', $content['default_client']);
106 $this->assertArrayHasKey('client_id', $content['default_client']);
107
108 $this->assertEquals('My client name !!', $content['default_client']['name']);
109
110 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));
111
112 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
113 }
114
115 public function testCreateNewUserWithExistingEmail()
116 {
117 $client = static::createClient();
118 $client->getContainer()->get('craue_config')->set('api_user_registration', 1);
119 $client->request('PUT', '/api/user.json', [
120 'username' => 'admin',
121 'password' => 'googlegoogle',
122 'email' => 'bigboss@wallabag.org',
123 ]);
124
125 $this->assertEquals(400, $client->getResponse()->getStatusCode());
126
127 $content = json_decode($client->getResponse()->getContent(), true);
128
129 $this->assertArrayHasKey('error', $content);
130 $this->assertArrayHasKey('username', $content['error']);
131 $this->assertArrayHasKey('email', $content['error']);
132
133 // $this->assertEquals('fos_user.username.already_used', $content['error']['username'][0]);
134 // $this->assertEquals('fos_user.email.already_used', $content['error']['email'][0]);
135 // This shouldn't be translated ...
136 $this->assertEquals('This value is already used.', $content['error']['username'][0]);
137 $this->assertEquals('This value is already used.', $content['error']['email'][0]);
138
139 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));
140
141 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
142 }
143
144 public function testCreateNewUserWithTooShortPassword()
145 {
146 $client = static::createClient();
147 $client->getContainer()->get('craue_config')->set('api_user_registration', 1);
148 $client->request('PUT', '/api/user.json', [
149 'username' => 'facebook',
150 'password' => 'face',
151 'email' => 'facebook@wallabag.org',
152 ]);
153
154 $this->assertEquals(400, $client->getResponse()->getStatusCode());
155
156 $content = json_decode($client->getResponse()->getContent(), true);
157
158 $this->assertArrayHasKey('error', $content);
159 $this->assertArrayHasKey('password', $content['error']);
160
161 $this->assertEquals('validator.password_too_short', $content['error']['password'][0]);
162
163 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));
164
165 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);
166 }
167
168 public function testCreateNewUserWhenRegistrationIsDisabled()
169 {
170 $client = static::createClient();
171 $client->request('PUT', '/api/user.json', [
172 'username' => 'facebook',
173 'password' => 'face',
174 'email' => 'facebook@wallabag.org',
175 ]);
176
177 $this->assertEquals(403, $client->getResponse()->getStatusCode());
178
179 $content = json_decode($client->getResponse()->getContent(), true);
180
181 $this->assertArrayHasKey('error', $content);
182
183 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));
184 }
185}
diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
index c87e58de..df638e8f 100644
--- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
@@ -8,12 +8,14 @@ class WallabagRestControllerTest extends WallabagApiTestCase
8{ 8{
9 public function testGetVersion() 9 public function testGetVersion()
10 { 10 {
11 $this->client->request('GET', '/api/version'); 11 // create a new client instead of using $this->client to be sure client isn't authenticated
12 $client = static::createClient();
13 $client->request('GET', '/api/version');
12 14
13 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 15 $this->assertEquals(200, $client->getResponse()->getStatusCode());
14 16
15 $content = json_decode($this->client->getResponse()->getContent(), true); 17 $content = json_decode($client->getResponse()->getContent(), true);
16 18
17 $this->assertEquals($this->client->getContainer()->getParameter('wallabag_core.version'), $content); 19 $this->assertEquals($client->getContainer()->getParameter('wallabag_core.version'), $content);
18 } 20 }
19} 21}
diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
index cf9b3347..8709da70 100644
--- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
+++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
@@ -8,7 +8,7 @@ use Symfony\Component\BrowserKit\Cookie;
8abstract class WallabagApiTestCase extends WebTestCase 8abstract class WallabagApiTestCase extends WebTestCase
9{ 9{
10 /** 10 /**
11 * @var Client 11 * @var \Symfony\Bundle\FrameworkBundle\Client
12 */ 12 */
13 protected $client = null; 13 protected $client = null;
14 14
@@ -23,7 +23,7 @@ abstract class WallabagApiTestCase extends WebTestCase
23 } 23 }
24 24
25 /** 25 /**
26 * @return Client 26 * @return \Symfony\Bundle\FrameworkBundle\Client
27 */ 27 */
28 protected function createAuthorizedClient() 28 protected function createAuthorizedClient()
29 { 29 {
@@ -37,7 +37,7 @@ abstract class WallabagApiTestCase extends WebTestCase
37 $firewallName = $container->getParameter('fos_user.firewall_name'); 37 $firewallName = $container->getParameter('fos_user.firewall_name');
38 38
39 $this->user = $userManager->findUserBy(['username' => 'admin']); 39 $this->user = $userManager->findUserBy(['username' => 'admin']);
40 $loginManager->loginUser($firewallName, $this->user); 40 $loginManager->logInUser($firewallName, $this->user);
41 41
42 // save the login token into the session and put it in a cookie 42 // save the login token into the session and put it in a cookie
43 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); 43 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken()));
diff --git a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php
new file mode 100644
index 00000000..e6e57f30
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php
@@ -0,0 +1,108 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Command;
4
5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\CoreBundle\Command\CleanDuplicatesCommand;
8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
9use Wallabag\CoreBundle\Entity\Entry;
10
11class CleanDuplicatesCommandTest extends WallabagCoreTestCase
12{
13 public function testRunCleanDuplicates()
14 {
15 $application = new Application($this->getClient()->getKernel());
16 $application->add(new CleanDuplicatesCommand());
17
18 $command = $application->find('wallabag:clean-duplicates');
19
20 $tester = new CommandTester($command);
21 $tester->execute([
22 'command' => $command->getName(),
23 ]);
24
25 $this->assertContains('Cleaning through 3 user accounts', $tester->getDisplay());
26 $this->assertContains('Finished cleaning. 0 duplicates found in total', $tester->getDisplay());
27 }
28
29 public function testRunCleanDuplicatesCommandWithBadUsername()
30 {
31 $application = new Application($this->getClient()->getKernel());
32 $application->add(new CleanDuplicatesCommand());
33
34 $command = $application->find('wallabag:clean-duplicates');
35
36 $tester = new CommandTester($command);
37 $tester->execute([
38 'command' => $command->getName(),
39 'username' => 'unknown',
40 ]);
41
42 $this->assertContains('User "unknown" not found', $tester->getDisplay());
43 }
44
45 public function testRunCleanDuplicatesCommandForUser()
46 {
47 $application = new Application($this->getClient()->getKernel());
48 $application->add(new CleanDuplicatesCommand());
49
50 $command = $application->find('wallabag:clean-duplicates');
51
52 $tester = new CommandTester($command);
53 $tester->execute([
54 'command' => $command->getName(),
55 'username' => 'admin',
56 ]);
57
58 $this->assertContains('Cleaned 0 duplicates for user admin', $tester->getDisplay());
59 }
60
61 public function testDuplicate()
62 {
63 $url = 'http://www.lemonde.fr/sport/visuel/2017/05/05/rondelle-prison-blanchissage-comprendre-le-hockey-sur-glace_5122587_3242.html';
64 $client = $this->getClient();
65 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
66
67 $this->logInAs('admin');
68
69 $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId());
70 $this->assertCount(0, $nbEntries);
71
72 $user = $em->getRepository('WallabagUserBundle:User')->findOneById($this->getLoggedInUserId());
73
74 $entry1 = new Entry($user);
75 $entry1->setUrl($url);
76
77 $entry2 = new Entry($user);
78 $entry2->setUrl($url);
79
80 $em->persist($entry1);
81 $em->persist($entry2);
82
83 $em->flush();
84
85 $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId());
86 $this->assertCount(2, $nbEntries);
87
88 $application = new Application($this->getClient()->getKernel());
89 $application->add(new CleanDuplicatesCommand());
90
91 $command = $application->find('wallabag:clean-duplicates');
92
93 $tester = new CommandTester($command);
94 $tester->execute([
95 'command' => $command->getName(),
96 'username' => 'admin',
97 ]);
98
99 $this->assertContains('Cleaned 1 duplicates for user admin', $tester->getDisplay());
100
101 $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId());
102 $this->assertCount(1, $nbEntries);
103
104 $query = $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.url = :url');
105 $query->setParameter('url', $url);
106 $query->execute();
107 }
108}
diff --git a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php
index 6798c5d7..2eebf39b 100644
--- a/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/ExportCommandTest.php
@@ -10,7 +10,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
10class ExportCommandTest extends WallabagCoreTestCase 10class ExportCommandTest extends WallabagCoreTestCase
11{ 11{
12 /** 12 /**
13 * @expectedException Symfony\Component\Console\Exception\RuntimeException 13 * @expectedException \Symfony\Component\Console\Exception\RuntimeException
14 * @expectedExceptionMessage Not enough arguments (missing: "username") 14 * @expectedExceptionMessage Not enough arguments (missing: "username")
15 */ 15 */
16 public function testExportCommandWithoutUsername() 16 public function testExportCommandWithoutUsername()
@@ -55,7 +55,7 @@ class ExportCommandTest extends WallabagCoreTestCase
55 'username' => 'admin', 55 'username' => 'admin',
56 ]); 56 ]);
57 57
58 $this->assertContains('Exporting 6 entrie(s) for user « admin »... Done', $tester->getDisplay()); 58 $this->assertContains('Exporting 5 entrie(s) for user « admin »... Done', $tester->getDisplay());
59 $this->assertFileExists('admin-export.json'); 59 $this->assertFileExists('admin-export.json');
60 } 60 }
61 61
@@ -70,7 +70,7 @@ class ExportCommandTest extends WallabagCoreTestCase
70 $tester->execute([ 70 $tester->execute([
71 'command' => $command->getName(), 71 'command' => $command->getName(),
72 'username' => 'admin', 72 'username' => 'admin',
73 'filepath' => 'specialexport.json' 73 'filepath' => 'specialexport.json',
74 ]); 74 ]);
75 75
76 $this->assertFileExists('specialexport.json'); 76 $this->assertFileExists('specialexport.json');
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
index 1bfd41d5..94fc0b94 100644
--- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
@@ -2,8 +2,11 @@
2 2
3namespace Tests\Wallabag\CoreBundle\Command; 3namespace Tests\Wallabag\CoreBundle\Command;
4 4
5use DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver;
5use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand; 6use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
6use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand; 7use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
8use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
9use Doctrine\DBAL\Platforms\SqlitePlatform;
7use Symfony\Bundle\FrameworkBundle\Console\Application; 10use Symfony\Bundle\FrameworkBundle\Console\Application;
8use Symfony\Component\Console\Input\ArrayInput; 11use Symfony\Component\Console\Input\ArrayInput;
9use Symfony\Component\Console\Output\NullOutput; 12use Symfony\Component\Console\Output\NullOutput;
@@ -18,7 +21,9 @@ class InstallCommandTest extends WallabagCoreTestCase
18 { 21 {
19 parent::setUp(); 22 parent::setUp();
20 23
21 if ($this->getClient()->getContainer()->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver) { 24 /** @var \Doctrine\DBAL\Connection $connection */
25 $connection = $this->getClient()->getContainer()->get('doctrine')->getConnection();
26 if ($connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
22 /* 27 /*
23 * LOG: statement: CREATE DATABASE "wallabag" 28 * LOG: statement: CREATE DATABASE "wallabag"
24 * ERROR: source database "template1" is being accessed by other users 29 * ERROR: source database "template1" is being accessed by other users
@@ -30,34 +35,44 @@ class InstallCommandTest extends WallabagCoreTestCase
30 */ 35 */
31 $this->markTestSkipped('PostgreSQL spotted: can\'t find a good way to drop current database, skipping.'); 36 $this->markTestSkipped('PostgreSQL spotted: can\'t find a good way to drop current database, skipping.');
32 } 37 }
33 }
34 38
35 /** 39 if ($connection->getDatabasePlatform() instanceof SqlitePlatform) {
36 * Ensure next tests will have a clean database. 40 // Environnement variable useful only for sqlite to avoid the error "attempt to write a readonly database"
37 */ 41 // We can't define always this environnement variable because pdo_mysql seems to use it
38 public static function tearDownAfterClass() 42 // and we have the error:
39 { 43 // SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;
40 $application = new Application(static::$kernel); 44 // check the manual that corresponds to your MariaDB server version for the right syntax to use
41 $application->setAutoExit(false); 45 // near '/tmp/wallabag_testTYj1kp' at line 1
46 $databasePath = tempnam(sys_get_temp_dir(), 'wallabag_test');
47 putenv("TEST_DATABASE_PATH=$databasePath");
48
49 // The environnement has been changed, recreate the client in order to update connection
50 parent::setUp();
51 }
42 52
43 $application->run(new ArrayInput([ 53 // disable doctrine-test-bundle
44 'command' => 'doctrine:schema:drop', 54 StaticDriver::setKeepStaticConnections(false);
45 '--no-interaction' => true,
46 '--force' => true,
47 '--env' => 'test',
48 ]), new NullOutput());
49 55
50 $application->run(new ArrayInput([ 56 $this->resetDatabase($this->getClient());
51 'command' => 'doctrine:schema:create', 57 }
52 '--no-interaction' => true,
53 '--env' => 'test',
54 ]), new NullOutput());
55 58
56 $application->run(new ArrayInput([ 59 public function tearDown()
57 'command' => 'doctrine:fixtures:load', 60 {
58 '--no-interaction' => true, 61 $databasePath = getenv('TEST_DATABASE_PATH');
59 '--env' => 'test', 62 // Remove variable environnement
60 ]), new NullOutput()); 63 putenv('TEST_DATABASE_PATH');
64 if ($databasePath && file_exists($databasePath)) {
65 unlink($databasePath);
66 } else {
67 // Create a new client to avoid the error:
68 // Transaction commit failed because the transaction has been marked for rollback only.
69 $client = static::createClient();
70 $this->resetDatabase($client);
71 }
72
73 // enable doctrine-test-bundle
74 StaticDriver::setKeepStaticConnections(true);
75 parent::tearDown();
61 } 76 }
62 77
63 public function testRunInstallCommand() 78 public function testRunInstallCommand()
@@ -67,18 +82,14 @@ class InstallCommandTest extends WallabagCoreTestCase
67 82
68 $command = $application->find('wallabag:install'); 83 $command = $application->find('wallabag:install');
69 84
70 // We mock the QuestionHelper
71 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
72 ->disableOriginalConstructor()
73 ->getMock();
74 $question->expects($this->any())
75 ->method('ask')
76 ->will($this->returnValue('yes_'.uniqid('', true)));
77
78 // We override the standard helper with our mock
79 $command->getHelperSet()->set($question, 'question');
80
81 $tester = new CommandTester($command); 85 $tester = new CommandTester($command);
86 $tester->setInputs([
87 'y', // dropping database
88 'y', // create super admin
89 'username_'.uniqid('', true), // username
90 'password_'.uniqid('', true), // password
91 'email_'.uniqid('', true).'@wallabag.it', // email
92 ]);
82 $tester->execute([ 93 $tester->execute([
83 'command' => $command->getName(), 94 'command' => $command->getName(),
84 ]); 95 ]);
@@ -87,6 +98,7 @@ class InstallCommandTest extends WallabagCoreTestCase
87 $this->assertContains('Setting up database.', $tester->getDisplay()); 98 $this->assertContains('Setting up database.', $tester->getDisplay());
88 $this->assertContains('Administration setup.', $tester->getDisplay()); 99 $this->assertContains('Administration setup.', $tester->getDisplay());
89 $this->assertContains('Config setup.', $tester->getDisplay()); 100 $this->assertContains('Config setup.', $tester->getDisplay());
101 $this->assertContains('Run migrations.', $tester->getDisplay());
90 } 102 }
91 103
92 public function testRunInstallCommandWithReset() 104 public function testRunInstallCommandWithReset()
@@ -96,18 +108,13 @@ class InstallCommandTest extends WallabagCoreTestCase
96 108
97 $command = $application->find('wallabag:install'); 109 $command = $application->find('wallabag:install');
98 110
99 // We mock the QuestionHelper
100 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
101 ->disableOriginalConstructor()
102 ->getMock();
103 $question->expects($this->any())
104 ->method('ask')
105 ->will($this->returnValue('yes_'.uniqid('', true)));
106
107 // We override the standard helper with our mock
108 $command->getHelperSet()->set($question, 'question');
109
110 $tester = new CommandTester($command); 111 $tester = new CommandTester($command);
112 $tester->setInputs([
113 'y', // create super admin
114 'username_'.uniqid('', true), // username
115 'password_'.uniqid('', true), // password
116 'email_'.uniqid('', true).'@wallabag.it', // email
117 ]);
111 $tester->execute([ 118 $tester->execute([
112 'command' => $command->getName(), 119 'command' => $command->getName(),
113 '--reset' => true, 120 '--reset' => true,
@@ -115,19 +122,20 @@ class InstallCommandTest extends WallabagCoreTestCase
115 122
116 $this->assertContains('Checking system requirements.', $tester->getDisplay()); 123 $this->assertContains('Checking system requirements.', $tester->getDisplay());
117 $this->assertContains('Setting up database.', $tester->getDisplay()); 124 $this->assertContains('Setting up database.', $tester->getDisplay());
118 $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); 125 $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay());
119 $this->assertContains('Administration setup.', $tester->getDisplay()); 126 $this->assertContains('Administration setup.', $tester->getDisplay());
120 $this->assertContains('Config setup.', $tester->getDisplay()); 127 $this->assertContains('Config setup.', $tester->getDisplay());
128 $this->assertContains('Run migrations.', $tester->getDisplay());
121 129
122 // we force to reset everything 130 // we force to reset everything
123 $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); 131 $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay());
124 } 132 }
125 133
126 public function testRunInstallCommandWithDatabaseRemoved() 134 public function testRunInstallCommandWithDatabaseRemoved()
127 { 135 {
128 // skipped SQLite check when database is removed because while testing for the connection, 136 // skipped SQLite check when database is removed because while testing for the connection,
129 // the driver will create the file (so the database) before testing if database exist 137 // the driver will create the file (so the database) before testing if database exist
130 if ($this->getClient()->getContainer()->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { 138 if ($this->getClient()->getContainer()->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
131 $this->markTestSkipped('SQLite spotted: can\'t test with database removed.'); 139 $this->markTestSkipped('SQLite spotted: can\'t test with database removed.');
132 } 140 }
133 141
@@ -148,18 +156,13 @@ class InstallCommandTest extends WallabagCoreTestCase
148 156
149 $command = $application->find('wallabag:install'); 157 $command = $application->find('wallabag:install');
150 158
151 // We mock the QuestionHelper
152 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
153 ->disableOriginalConstructor()
154 ->getMock();
155 $question->expects($this->any())
156 ->method('ask')
157 ->will($this->returnValue('yes_'.uniqid('', true)));
158
159 // We override the standard helper with our mock
160 $command->getHelperSet()->set($question, 'question');
161
162 $tester = new CommandTester($command); 159 $tester = new CommandTester($command);
160 $tester->setInputs([
161 'y', // create super admin
162 'username_'.uniqid('', true), // username
163 'password_'.uniqid('', true), // password
164 'email_'.uniqid('', true).'@wallabag.it', // email
165 ]);
163 $tester->execute([ 166 $tester->execute([
164 'command' => $command->getName(), 167 'command' => $command->getName(),
165 ]); 168 ]);
@@ -168,6 +171,7 @@ class InstallCommandTest extends WallabagCoreTestCase
168 $this->assertContains('Setting up database.', $tester->getDisplay()); 171 $this->assertContains('Setting up database.', $tester->getDisplay());
169 $this->assertContains('Administration setup.', $tester->getDisplay()); 172 $this->assertContains('Administration setup.', $tester->getDisplay());
170 $this->assertContains('Config setup.', $tester->getDisplay()); 173 $this->assertContains('Config setup.', $tester->getDisplay());
174 $this->assertContains('Run migrations.', $tester->getDisplay());
171 175
172 // the current database doesn't already exist 176 // the current database doesn't already exist
173 $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); 177 $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay());
@@ -180,23 +184,12 @@ class InstallCommandTest extends WallabagCoreTestCase
180 184
181 $command = $application->find('wallabag:install'); 185 $command = $application->find('wallabag:install');
182 186
183 // We mock the QuestionHelper
184 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
185 ->disableOriginalConstructor()
186 ->getMock();
187
188 $question->expects($this->exactly(3))
189 ->method('ask')
190 ->will($this->onConsecutiveCalls(
191 false, // don't want to reset the entire database
192 true, // do want to reset the schema
193 false // don't want to create a new user
194 ));
195
196 // We override the standard helper with our mock
197 $command->getHelperSet()->set($question, 'question');
198
199 $tester = new CommandTester($command); 187 $tester = new CommandTester($command);
188 $tester->setInputs([
189 'n', // don't want to reset the entire database
190 'y', // do want to reset the schema
191 'n', // don't want to create a new user
192 ]);
200 $tester->execute([ 193 $tester->execute([
201 'command' => $command->getName(), 194 'command' => $command->getName(),
202 ]); 195 ]);
@@ -205,8 +198,9 @@ class InstallCommandTest extends WallabagCoreTestCase
205 $this->assertContains('Setting up database.', $tester->getDisplay()); 198 $this->assertContains('Setting up database.', $tester->getDisplay());
206 $this->assertContains('Administration setup.', $tester->getDisplay()); 199 $this->assertContains('Administration setup.', $tester->getDisplay());
207 $this->assertContains('Config setup.', $tester->getDisplay()); 200 $this->assertContains('Config setup.', $tester->getDisplay());
201 $this->assertContains('Run migrations.', $tester->getDisplay());
208 202
209 $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); 203 $this->assertContains('Dropping schema and creating schema', $tester->getDisplay());
210 } 204 }
211 205
212 public function testRunInstallCommandChooseNothing() 206 public function testRunInstallCommandChooseNothing()
@@ -235,22 +229,11 @@ class InstallCommandTest extends WallabagCoreTestCase
235 229
236 $command = $application->find('wallabag:install'); 230 $command = $application->find('wallabag:install');
237 231
238 // We mock the QuestionHelper
239 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
240 ->disableOriginalConstructor()
241 ->getMock();
242
243 $question->expects($this->exactly(2))
244 ->method('ask')
245 ->will($this->onConsecutiveCalls(
246 false, // don't want to reset the entire database
247 false // don't want to create a new user
248 ));
249
250 // We override the standard helper with our mock
251 $command->getHelperSet()->set($question, 'question');
252
253 $tester = new CommandTester($command); 232 $tester = new CommandTester($command);
233 $tester->setInputs([
234 'n', // don't want to reset the entire database
235 'n', // don't want to create a new user
236 ]);
254 $tester->execute([ 237 $tester->execute([
255 'command' => $command->getName(), 238 'command' => $command->getName(),
256 ]); 239 ]);
@@ -259,6 +242,7 @@ class InstallCommandTest extends WallabagCoreTestCase
259 $this->assertContains('Setting up database.', $tester->getDisplay()); 242 $this->assertContains('Setting up database.', $tester->getDisplay());
260 $this->assertContains('Administration setup.', $tester->getDisplay()); 243 $this->assertContains('Administration setup.', $tester->getDisplay());
261 $this->assertContains('Config setup.', $tester->getDisplay()); 244 $this->assertContains('Config setup.', $tester->getDisplay());
245 $this->assertContains('Run migrations.', $tester->getDisplay());
262 246
263 $this->assertContains('Creating schema', $tester->getDisplay()); 247 $this->assertContains('Creating schema', $tester->getDisplay());
264 } 248 }
@@ -270,26 +254,17 @@ class InstallCommandTest extends WallabagCoreTestCase
270 254
271 $command = $application->find('wallabag:install'); 255 $command = $application->find('wallabag:install');
272 256
273 // We mock the QuestionHelper
274 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
275 ->disableOriginalConstructor()
276 ->getMock();
277 $question->expects($this->any())
278 ->method('ask')
279 ->will($this->returnValue('yes_'.uniqid('', true)));
280
281 // We override the standard helper with our mock
282 $command->getHelperSet()->set($question, 'question');
283
284 $tester = new CommandTester($command); 257 $tester = new CommandTester($command);
285 $tester->execute([ 258 $tester->execute([
286 'command' => $command->getName(), 259 'command' => $command->getName(),
287 '--no-interaction' => true, 260 ], [
261 'interactive' => false,
288 ]); 262 ]);
289 263
290 $this->assertContains('Checking system requirements.', $tester->getDisplay()); 264 $this->assertContains('Checking system requirements.', $tester->getDisplay());
291 $this->assertContains('Setting up database.', $tester->getDisplay()); 265 $this->assertContains('Setting up database.', $tester->getDisplay());
292 $this->assertContains('Administration setup.', $tester->getDisplay()); 266 $this->assertContains('Administration setup.', $tester->getDisplay());
293 $this->assertContains('Config setup.', $tester->getDisplay()); 267 $this->assertContains('Config setup.', $tester->getDisplay());
268 $this->assertContains('Run migrations.', $tester->getDisplay());
294 } 269 }
295} 270}
diff --git a/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php b/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php
new file mode 100644
index 00000000..c0a4acfa
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php
@@ -0,0 +1,93 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Command;
4
5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester;
7use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
8use Wallabag\CoreBundle\Command\ShowUserCommand;
9use Wallabag\UserBundle\Entity\User;
10
11class ShowUserCommandTest extends WallabagCoreTestCase
12{
13 /**
14 * @expectedException \Symfony\Component\Console\Exception\RuntimeException
15 * @expectedExceptionMessage Not enough arguments
16 */
17 public function testRunShowUserCommandWithoutUsername()
18 {
19 $application = new Application($this->getClient()->getKernel());
20 $application->add(new ShowUserCommand());
21
22 $command = $application->find('wallabag:user:show');
23
24 $tester = new CommandTester($command);
25 $tester->execute([
26 'command' => $command->getName(),
27 ]);
28 }
29
30 public function testRunShowUserCommandWithBadUsername()
31 {
32 $application = new Application($this->getClient()->getKernel());
33 $application->add(new ShowUserCommand());
34
35 $command = $application->find('wallabag:user:show');
36
37 $tester = new CommandTester($command);
38 $tester->execute([
39 'command' => $command->getName(),
40 'username' => 'unknown',
41 ]);
42
43 $this->assertContains('User "unknown" not found', $tester->getDisplay());
44 }
45
46 public function testRunShowUserCommandForUser()
47 {
48 $application = new Application($this->getClient()->getKernel());
49 $application->add(new ShowUserCommand());
50
51 $command = $application->find('wallabag:user:show');
52
53 $tester = new CommandTester($command);
54 $tester->execute([
55 'command' => $command->getName(),
56 'username' => 'admin',
57 ]);
58
59 $this->assertContains('Username : admin', $tester->getDisplay());
60 $this->assertContains('Email : bigboss@wallabag.org', $tester->getDisplay());
61 $this->assertContains('Display name : Big boss', $tester->getDisplay());
62 $this->assertContains('2FA activated: no', $tester->getDisplay());
63 }
64
65 public function testShowUser()
66 {
67 $client = $this->getClient();
68 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
69
70 $this->logInAs('admin');
71
72 /** @var User $user */
73 $user = $em->getRepository('WallabagUserBundle:User')->findOneById($this->getLoggedInUserId());
74
75 $user->setName('Bug boss');
76 $em->persist($user);
77
78 $em->flush();
79
80 $application = new Application($this->getClient()->getKernel());
81 $application->add(new ShowUserCommand());
82
83 $command = $application->find('wallabag:user:show');
84
85 $tester = new CommandTester($command);
86 $tester->execute([
87 'command' => $command->getName(),
88 'username' => 'admin',
89 ]);
90
91 $this->assertContains('Display name : Bug boss', $tester->getDisplay());
92 }
93}
diff --git a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php
index ec31708f..4cde3679 100644
--- a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php
@@ -10,7 +10,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
10class TagAllCommandTest extends WallabagCoreTestCase 10class TagAllCommandTest extends WallabagCoreTestCase
11{ 11{
12 /** 12 /**
13 * @expectedException Symfony\Component\Console\Exception\RuntimeException 13 * @expectedException \Symfony\Component\Console\Exception\RuntimeException
14 * @expectedExceptionMessage Not enough arguments (missing: "username") 14 * @expectedExceptionMessage Not enough arguments (missing: "username")
15 */ 15 */
16 public function testRunTagAllCommandWithoutUsername() 16 public function testRunTagAllCommandWithoutUsername()
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index beb0598a..5bc815ee 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -67,8 +67,17 @@ class ConfigControllerTest extends WallabagCoreTestCase
67 public function testChangeReadingSpeed() 67 public function testChangeReadingSpeed()
68 { 68 {
69 $this->logInAs('admin'); 69 $this->logInAs('admin');
70 $this->useTheme('baggy');
70 $client = $this->getClient(); 71 $client = $this->getClient();
71 72
73 $entry = new Entry($this->getLoggedInUser());
74 $entry->setUrl('http://0.0.0.0/test-entry1')
75 ->setReadingTime(22);
76 $this->getEntityManager()->persist($entry);
77
78 $this->getEntityManager()->flush();
79 $this->getEntityManager()->clear();
80
72 $crawler = $client->request('GET', '/unread/list'); 81 $crawler = $client->request('GET', '/unread/list');
73 $form = $crawler->filter('button[id=submit-filter]')->form(); 82 $form = $crawler->filter('button[id=submit-filter]')->form();
74 $dataFilters = [ 83 $dataFilters = [
@@ -409,6 +418,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
409 public function testTaggingRuleCreation() 418 public function testTaggingRuleCreation()
410 { 419 {
411 $this->logInAs('admin'); 420 $this->logInAs('admin');
421 $this->useTheme('baggy');
412 $client = $this->getClient(); 422 $client = $this->getClient();
413 423
414 $crawler = $client->request('GET', '/config'); 424 $crawler = $client->request('GET', '/config');
@@ -798,11 +808,87 @@ class ConfigControllerTest extends WallabagCoreTestCase
798 808
799 $entryReset = $em 809 $entryReset = $em
800 ->getRepository('WallabagCoreBundle:Entry') 810 ->getRepository('WallabagCoreBundle:Entry')
801 ->countAllEntriesByUsername($user->getId()); 811 ->countAllEntriesByUser($user->getId());
802 812
803 $this->assertEquals(0, $entryReset, 'Entries were reset'); 813 $this->assertEquals(0, $entryReset, 'Entries were reset');
804 } 814 }
805 815
816 public function testResetArchivedEntries()
817 {
818 $this->logInAs('empty');
819 $client = $this->getClient();
820
821 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
822
823 $user = static::$kernel->getContainer()->get('security.token_storage')->getToken()->getUser();
824
825 $tag = new Tag();
826 $tag->setLabel('super');
827 $em->persist($tag);
828
829 $entry = new Entry($user);
830 $entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
831 $entry->setContent('Youhou');
832 $entry->setTitle('Youhou');
833 $entry->addTag($tag);
834 $em->persist($entry);
835
836 $annotation = new Annotation($user);
837 $annotation->setText('annotated');
838 $annotation->setQuote('annotated');
839 $annotation->setRanges([]);
840 $annotation->setEntry($entry);
841 $em->persist($annotation);
842
843 $tagArchived = new Tag();
844 $tagArchived->setLabel('super');
845 $em->persist($tagArchived);
846
847 $entryArchived = new Entry($user);
848 $entryArchived->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
849 $entryArchived->setContent('Youhou');
850 $entryArchived->setTitle('Youhou');
851 $entryArchived->addTag($tagArchived);
852 $entryArchived->setArchived(true);
853 $em->persist($entryArchived);
854
855 $annotationArchived = new Annotation($user);
856 $annotationArchived->setText('annotated');
857 $annotationArchived->setQuote('annotated');
858 $annotationArchived->setRanges([]);
859 $annotationArchived->setEntry($entryArchived);
860 $em->persist($annotationArchived);
861
862 $em->flush();
863
864 $crawler = $client->request('GET', '/config#set3');
865
866 $this->assertEquals(200, $client->getResponse()->getStatusCode());
867
868 $crawler = $client->click($crawler->selectLink('config.reset.archived')->link());
869
870 $this->assertEquals(302, $client->getResponse()->getStatusCode());
871 $this->assertContains('flashes.config.notice.archived_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]);
872
873 $entryReset = $em
874 ->getRepository('WallabagCoreBundle:Entry')
875 ->countAllEntriesByUser($user->getId());
876
877 $this->assertEquals(1, $entryReset, 'Entries were reset');
878
879 $tagReset = $em
880 ->getRepository('WallabagCoreBundle:Tag')
881 ->countAllTags($user->getId());
882
883 $this->assertEquals(1, $tagReset, 'Tags were reset');
884
885 $annotationsReset = $em
886 ->getRepository('WallabagAnnotationBundle:Annotation')
887 ->findAnnotationsByPageId($annotationArchived->getId(), $user->getId());
888
889 $this->assertEmpty($annotationsReset, 'Annotations were reset');
890 }
891
806 public function testResetEntriesCascade() 892 public function testResetEntriesCascade()
807 { 893 {
808 $this->logInAs('empty'); 894 $this->logInAs('empty');
@@ -843,7 +929,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
843 929
844 $entryReset = $em 930 $entryReset = $em
845 ->getRepository('WallabagCoreBundle:Entry') 931 ->getRepository('WallabagCoreBundle:Entry')
846 ->countAllEntriesByUsername($user->getId()); 932 ->countAllEntriesByUser($user->getId());
847 933
848 $this->assertEquals(0, $entryReset, 'Entries were reset'); 934 $this->assertEquals(0, $entryReset, 'Entries were reset');
849 935
@@ -863,6 +949,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
863 public function testSwitchViewMode() 949 public function testSwitchViewMode()
864 { 950 {
865 $this->logInAs('admin'); 951 $this->logInAs('admin');
952 $this->useTheme('baggy');
866 $client = $this->getClient(); 953 $client = $this->getClient();
867 954
868 $client->request('GET', '/unread/list'); 955 $client->request('GET', '/unread/list');
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 7db4cf1f..7cf28bfe 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -5,11 +5,28 @@ namespace Tests\Wallabag\CoreBundle\Controller;
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Wallabag\CoreBundle\Entity\Config; 6use Wallabag\CoreBundle\Entity\Config;
7use Wallabag\CoreBundle\Entity\Entry; 7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\CoreBundle\Entity\SiteCredential;
8 9
9class EntryControllerTest extends WallabagCoreTestCase 10class EntryControllerTest extends WallabagCoreTestCase
10{ 11{
12 public $downloadImagesEnabled = false;
11 public $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'; 13 public $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';
12 14
15 /**
16 * @after
17 *
18 * Ensure download_images_enabled is disabled after each script
19 */
20 public function tearDownImagesEnabled()
21 {
22 if ($this->downloadImagesEnabled) {
23 $client = static::createClient();
24 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
25
26 $this->downloadImagesEnabled = false;
27 }
28 }
29
13 public function testLogin() 30 public function testLogin()
14 { 31 {
15 $client = $this->getClient(); 32 $client = $this->getClient();
@@ -55,6 +72,7 @@ class EntryControllerTest extends WallabagCoreTestCase
55 public function testGetNew() 72 public function testGetNew()
56 { 73 {
57 $this->logInAs('admin'); 74 $this->logInAs('admin');
75 $this->useTheme('baggy');
58 $client = $this->getClient(); 76 $client = $this->getClient();
59 77
60 $crawler = $client->request('GET', '/new'); 78 $crawler = $client->request('GET', '/new');
@@ -68,6 +86,7 @@ class EntryControllerTest extends WallabagCoreTestCase
68 public function testPostNewViaBookmarklet() 86 public function testPostNewViaBookmarklet()
69 { 87 {
70 $this->logInAs('admin'); 88 $this->logInAs('admin');
89 $this->useTheme('baggy');
71 $client = $this->getClient(); 90 $client = $this->getClient();
72 91
73 $crawler = $client->request('GET', '/'); 92 $crawler = $client->request('GET', '/');
@@ -135,14 +154,58 @@ class EntryControllerTest extends WallabagCoreTestCase
135 ->getRepository('WallabagCoreBundle:Entry') 154 ->getRepository('WallabagCoreBundle:Entry')
136 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 155 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
137 156
157 $author = $content->getPublishedBy();
158
138 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 159 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
139 $this->assertEquals($this->url, $content->getUrl()); 160 $this->assertEquals($this->url, $content->getUrl());
140 $this->assertContains('Google', $content->getTitle()); 161 $this->assertContains('Google', $content->getTitle());
162 $this->assertEquals('fr', $content->getLanguage());
163 $this->assertEquals('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s'));
164 $this->assertEquals('Morgane Tual', $author[0]);
165 $this->assertArrayHasKey('x-varnish1', $content->getHeaders());
166 }
167
168 public function testPostWithMultipleAuthors()
169 {
170 $url = 'http://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768';
171 $this->logInAs('admin');
172 $client = $this->getClient();
173
174 $crawler = $client->request('GET', '/new');
175
176 $this->assertEquals(200, $client->getResponse()->getStatusCode());
177
178 $form = $crawler->filter('form[name=entry]')->form();
179
180 $data = [
181 'entry[url]' => $url,
182 ];
183
184 $client->submit($form, $data);
185
186 $this->assertEquals(302, $client->getResponse()->getStatusCode());
187
188 $content = $client->getContainer()
189 ->get('doctrine.orm.entity_manager')
190 ->getRepository('WallabagCoreBundle:Entry')
191 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
192
193 $authors = $content->getPublishedBy();
194 $this->assertEquals('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s'));
195 $this->assertEquals('fr', $content->getLanguage());
196 $this->assertEquals('Raphaël Balenieri, correspondant à Pékin', $authors[0]);
197 $this->assertEquals('Frédéric Autran, correspondant à New York', $authors[1]);
141 } 198 }
142 199
143 public function testPostNewOkUrlExist() 200 public function testPostNewOkUrlExist()
144 { 201 {
145 $this->logInAs('admin'); 202 $this->logInAs('admin');
203
204 $entry = new Entry($this->getLoggedInUser());
205 $entry->setUrl($this->url);
206 $this->getEntityManager()->persist($entry);
207 $this->getEntityManager()->flush();
208
146 $client = $this->getClient(); 209 $client = $this->getClient();
147 210
148 $crawler = $client->request('GET', '/new'); 211 $crawler = $client->request('GET', '/new');
@@ -194,15 +257,6 @@ class EntryControllerTest extends WallabagCoreTestCase
194 257
195 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 258 $this->assertEquals(302, $client->getResponse()->getStatusCode());
196 $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); 259 $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
197
198 $em = $client->getContainer()
199 ->get('doctrine.orm.entity_manager');
200 $entry = $em
201 ->getRepository('WallabagCoreBundle:Entry')
202 ->findOneByUrl(urldecode($url));
203
204 $em->remove($entry);
205 $em->flush();
206 } 260 }
207 261
208 /** 262 /**
@@ -235,8 +289,9 @@ class EntryControllerTest extends WallabagCoreTestCase
235 ->findOneByUrl($url); 289 ->findOneByUrl($url);
236 $tags = $entry->getTags(); 290 $tags = $entry->getTags();
237 291
238 $this->assertCount(1, $tags); 292 $this->assertCount(2, $tags);
239 $this->assertEquals('wallabag', $tags[0]->getLabel()); 293 $this->assertContains('wallabag', $tags);
294 $this->assertEquals('en', $entry->getLanguage());
240 295
241 $em->remove($entry); 296 $em->remove($entry);
242 $em->flush(); 297 $em->flush();
@@ -264,8 +319,8 @@ class EntryControllerTest extends WallabagCoreTestCase
264 319
265 $tags = $entry->getTags(); 320 $tags = $entry->getTags();
266 321
267 $this->assertCount(1, $tags); 322 $this->assertCount(2, $tags);
268 $this->assertEquals('wallabag', $tags[0]->getLabel()); 323 $this->assertContains('wallabag', $tags);
269 324
270 $em->remove($entry); 325 $em->remove($entry);
271 $em->flush(); 326 $em->flush();
@@ -312,29 +367,26 @@ class EntryControllerTest extends WallabagCoreTestCase
312 $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl()); 367 $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl());
313 } 368 }
314 369
315 /**
316 * @depends testPostNewOk
317 */
318 public function testView() 370 public function testView()
319 { 371 {
320 $this->logInAs('admin'); 372 $this->logInAs('admin');
321 $client = $this->getClient(); 373 $client = $this->getClient();
322 374
323 $content = $client->getContainer() 375 $entry = new Entry($this->getLoggedInUser());
324 ->get('doctrine.orm.entity_manager') 376 $entry->setUrl('http://example.com/foo');
325 ->getRepository('WallabagCoreBundle:Entry') 377 $entry->setTitle('title foo');
326 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 378 $entry->setContent('foo bar baz');
379 $this->getEntityManager()->persist($entry);
380 $this->getEntityManager()->flush();
327 381
328 $crawler = $client->request('GET', '/view/'.$content->getId()); 382 $crawler = $client->request('GET', '/view/'.$entry->getId());
329 383
330 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 384 $this->assertEquals(200, $client->getResponse()->getStatusCode());
331 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); 385 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
332 $this->assertContains($content->getTitle(), $body[0]); 386 $this->assertContains($entry->getTitle(), $body[0]);
333 } 387 }
334 388
335 /** 389 /**
336 * @depends testPostNewOk
337 *
338 * This test will require an internet connection. 390 * This test will require an internet connection.
339 */ 391 */
340 public function testReload() 392 public function testReload()
@@ -342,63 +394,45 @@ class EntryControllerTest extends WallabagCoreTestCase
342 $this->logInAs('admin'); 394 $this->logInAs('admin');
343 $client = $this->getClient(); 395 $client = $this->getClient();
344 396
345 $em = $client->getContainer() 397 $entry = new Entry($this->getLoggedInUser());
346 ->get('doctrine.orm.entity_manager'); 398 $entry->setUrl($this->url);
347 399 $entry->setTitle('title foo');
348 $content = $em 400 $entry->setContent('');
349 ->getRepository('WallabagCoreBundle:Entry') 401 $this->getEntityManager()->persist($entry);
350 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 402 $this->getEntityManager()->flush();
403 $this->getEntityManager()->clear();
351 404
352 // empty content 405 $client->request('GET', '/reload/'.$entry->getId());
353 $content->setContent('');
354 $em->persist($content);
355 $em->flush();
356
357 $client->request('GET', '/reload/'.$content->getId());
358 406
359 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 407 $this->assertEquals(302, $client->getResponse()->getStatusCode());
360 408
361 $content = $em 409 $entry = $this->getEntityManager()
362 ->getRepository('WallabagCoreBundle:Entry') 410 ->getRepository('WallabagCoreBundle:Entry')
363 ->find($content->getId()); 411 ->find($entry->getId());
364 412
365 $this->assertNotEmpty($content->getContent()); 413 $this->assertNotEmpty($entry->getContent());
366 } 414 }
367 415
368 /**
369 * @depends testPostNewOk
370 */
371 public function testReloadWithFetchingFailed() 416 public function testReloadWithFetchingFailed()
372 { 417 {
373 $this->logInAs('admin'); 418 $this->logInAs('admin');
374 $client = $this->getClient(); 419 $client = $this->getClient();
375 420
376 $em = $client->getContainer() 421 $entry = new Entry($this->getLoggedInUser());
377 ->get('doctrine.orm.entity_manager'); 422 $entry->setUrl('http://0.0.0.0/failed.html');
378 423 $this->getEntityManager()->persist($entry);
379 $content = $em 424 $this->getEntityManager()->flush();
380 ->getRepository('WallabagCoreBundle:Entry')
381 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
382
383 // put a known failed url
384 $content->setUrl('http://0.0.0.0/failed.html');
385 $em->persist($content);
386 $em->flush();
387 425
388 $client->request('GET', '/reload/'.$content->getId()); 426 $client->request('GET', '/reload/'.$entry->getId());
389 427
390 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 428 $this->assertEquals(302, $client->getResponse()->getStatusCode());
391 429
392 // force EntityManager to clear previous entity 430 // force EntityManager to clear previous entity
393 // otherwise, retrieve the same entity will retrieve change from the previous request :0 431 // otherwise, retrieve the same entity will retrieve change from the previous request :0
394 $em->clear(); 432 $this->getEntityManager()->clear();
395 $newContent = $em 433 $newContent = $this->getEntityManager()
396 ->getRepository('WallabagCoreBundle:Entry') 434 ->getRepository('WallabagCoreBundle:Entry')
397 ->find($content->getId()); 435 ->find($entry->getId());
398
399 $newContent->setUrl($this->url);
400 $em->persist($newContent);
401 $em->flush();
402 436
403 $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); 437 $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent());
404 } 438 }
@@ -408,12 +442,12 @@ class EntryControllerTest extends WallabagCoreTestCase
408 $this->logInAs('admin'); 442 $this->logInAs('admin');
409 $client = $this->getClient(); 443 $client = $this->getClient();
410 444
411 $content = $client->getContainer() 445 $entry = new Entry($this->getLoggedInUser());
412 ->get('doctrine.orm.entity_manager') 446 $entry->setUrl($this->url);
413 ->getRepository('WallabagCoreBundle:Entry') 447 $this->getEntityManager()->persist($entry);
414 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 448 $this->getEntityManager()->flush();
415 449
416 $crawler = $client->request('GET', '/edit/'.$content->getId()); 450 $crawler = $client->request('GET', '/edit/'.$entry->getId());
417 451
418 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 452 $this->assertEquals(200, $client->getResponse()->getStatusCode());
419 453
@@ -426,12 +460,12 @@ class EntryControllerTest extends WallabagCoreTestCase
426 $this->logInAs('admin'); 460 $this->logInAs('admin');
427 $client = $this->getClient(); 461 $client = $this->getClient();
428 462
429 $content = $client->getContainer() 463 $entry = new Entry($this->getLoggedInUser());
430 ->get('doctrine.orm.entity_manager') 464 $entry->setUrl($this->url);
431 ->getRepository('WallabagCoreBundle:Entry') 465 $this->getEntityManager()->persist($entry);
432 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 466 $this->getEntityManager()->flush();
433 467
434 $crawler = $client->request('GET', '/edit/'.$content->getId()); 468 $crawler = $client->request('GET', '/edit/'.$entry->getId());
435 469
436 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 470 $this->assertEquals(200, $client->getResponse()->getStatusCode());
437 471
@@ -456,19 +490,20 @@ class EntryControllerTest extends WallabagCoreTestCase
456 $this->logInAs('admin'); 490 $this->logInAs('admin');
457 $client = $this->getClient(); 491 $client = $this->getClient();
458 492
459 $content = $client->getContainer() 493 $entry = new Entry($this->getLoggedInUser());
460 ->get('doctrine.orm.entity_manager') 494 $entry->setUrl($this->url);
461 ->getRepository('WallabagCoreBundle:Entry') 495 $this->getEntityManager()->persist($entry);
462 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 496 $this->getEntityManager()->flush();
497 $this->getEntityManager()->clear();
463 498
464 $client->request('GET', '/archive/'.$content->getId()); 499 $client->request('GET', '/archive/'.$entry->getId());
465 500
466 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 501 $this->assertEquals(302, $client->getResponse()->getStatusCode());
467 502
468 $res = $client->getContainer() 503 $res = $client->getContainer()
469 ->get('doctrine.orm.entity_manager') 504 ->get('doctrine.orm.entity_manager')
470 ->getRepository('WallabagCoreBundle:Entry') 505 ->getRepository('WallabagCoreBundle:Entry')
471 ->find($content->getId()); 506 ->find($entry->getId());
472 507
473 $this->assertEquals($res->isArchived(), true); 508 $this->assertEquals($res->isArchived(), true);
474 } 509 }
@@ -478,19 +513,20 @@ class EntryControllerTest extends WallabagCoreTestCase
478 $this->logInAs('admin'); 513 $this->logInAs('admin');
479 $client = $this->getClient(); 514 $client = $this->getClient();
480 515
481 $content = $client->getContainer() 516 $entry = new Entry($this->getLoggedInUser());
482 ->get('doctrine.orm.entity_manager') 517 $entry->setUrl($this->url);
483 ->getRepository('WallabagCoreBundle:Entry') 518 $this->getEntityManager()->persist($entry);
484 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 519 $this->getEntityManager()->flush();
520 $this->getEntityManager()->clear();
485 521
486 $client->request('GET', '/star/'.$content->getId()); 522 $client->request('GET', '/star/'.$entry->getId());
487 523
488 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 524 $this->assertEquals(302, $client->getResponse()->getStatusCode());
489 525
490 $res = $client->getContainer() 526 $res = $client->getContainer()
491 ->get('doctrine.orm.entity_manager') 527 ->get('doctrine.orm.entity_manager')
492 ->getRepository('WallabagCoreBundle:Entry') 528 ->getRepository('WallabagCoreBundle:Entry')
493 ->findOneById($content->getId()); 529 ->findOneById($entry->getId());
494 530
495 $this->assertEquals($res->isStarred(), true); 531 $this->assertEquals($res->isStarred(), true);
496 } 532 }
@@ -500,16 +536,16 @@ class EntryControllerTest extends WallabagCoreTestCase
500 $this->logInAs('admin'); 536 $this->logInAs('admin');
501 $client = $this->getClient(); 537 $client = $this->getClient();
502 538
503 $content = $client->getContainer() 539 $entry = new Entry($this->getLoggedInUser());
504 ->get('doctrine.orm.entity_manager') 540 $entry->setUrl($this->url);
505 ->getRepository('WallabagCoreBundle:Entry') 541 $this->getEntityManager()->persist($entry);
506 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 542 $this->getEntityManager()->flush();
507 543
508 $client->request('GET', '/delete/'.$content->getId()); 544 $client->request('GET', '/delete/'.$entry->getId());
509 545
510 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 546 $this->assertEquals(302, $client->getResponse()->getStatusCode());
511 547
512 $client->request('GET', '/delete/'.$content->getId()); 548 $client->request('GET', '/delete/'.$entry->getId());
513 549
514 $this->assertEquals(404, $client->getResponse()->getStatusCode()); 550 $this->assertEquals(404, $client->getResponse()->getStatusCode());
515 } 551 }
@@ -575,7 +611,13 @@ class EntryControllerTest extends WallabagCoreTestCase
575 public function testFilterOnReadingTime() 611 public function testFilterOnReadingTime()
576 { 612 {
577 $this->logInAs('admin'); 613 $this->logInAs('admin');
614 $this->useTheme('baggy');
578 $client = $this->getClient(); 615 $client = $this->getClient();
616 $entry = new Entry($this->getLoggedInUser());
617 $entry->setUrl($this->url);
618 $entry->setReadingTime(22);
619 $this->getEntityManager()->persist($entry);
620 $this->getEntityManager()->flush();
579 621
580 $crawler = $client->request('GET', '/unread/list'); 622 $crawler = $client->request('GET', '/unread/list');
581 623
@@ -614,9 +656,20 @@ class EntryControllerTest extends WallabagCoreTestCase
614 public function testFilterOnReadingTimeOnlyUpper() 656 public function testFilterOnReadingTimeOnlyUpper()
615 { 657 {
616 $this->logInAs('admin'); 658 $this->logInAs('admin');
659 $this->useTheme('baggy');
617 $client = $this->getClient(); 660 $client = $this->getClient();
618 661
619 $crawler = $client->request('GET', '/unread/list'); 662 $crawler = $client->request('GET', '/all/list');
663 $this->assertCount(5, $crawler->filter('div[class=entry]'));
664
665 $entry = new Entry($this->getLoggedInUser());
666 $entry->setUrl($this->url);
667 $entry->setReadingTime(23);
668 $this->getEntityManager()->persist($entry);
669 $this->getEntityManager()->flush();
670
671 $crawler = $client->request('GET', '/all/list');
672 $this->assertCount(6, $crawler->filter('div[class=entry]'));
620 673
621 $form = $crawler->filter('button[id=submit-filter]')->form(); 674 $form = $crawler->filter('button[id=submit-filter]')->form();
622 675
@@ -626,12 +679,13 @@ class EntryControllerTest extends WallabagCoreTestCase
626 679
627 $crawler = $client->submit($form, $data); 680 $crawler = $client->submit($form, $data);
628 681
629 $this->assertCount(2, $crawler->filter('div[class=entry]')); 682 $this->assertCount(5, $crawler->filter('div[class=entry]'));
630 } 683 }
631 684
632 public function testFilterOnReadingTimeOnlyLower() 685 public function testFilterOnReadingTimeOnlyLower()
633 { 686 {
634 $this->logInAs('admin'); 687 $this->logInAs('admin');
688 $this->useTheme('baggy');
635 $client = $this->getClient(); 689 $client = $this->getClient();
636 690
637 $crawler = $client->request('GET', '/unread/list'); 691 $crawler = $client->request('GET', '/unread/list');
@@ -644,12 +698,22 @@ class EntryControllerTest extends WallabagCoreTestCase
644 698
645 $crawler = $client->submit($form, $data); 699 $crawler = $client->submit($form, $data);
646 700
647 $this->assertCount(4, $crawler->filter('div[class=entry]')); 701 $this->assertCount(0, $crawler->filter('div[class=entry]'));
702
703 $entry = new Entry($this->getLoggedInUser());
704 $entry->setUrl($this->url);
705 $entry->setReadingTime(23);
706 $this->getEntityManager()->persist($entry);
707 $this->getEntityManager()->flush();
708
709 $crawler = $client->submit($form, $data);
710 $this->assertCount(1, $crawler->filter('div[class=entry]'));
648 } 711 }
649 712
650 public function testFilterOnUnreadStatus() 713 public function testFilterOnUnreadStatus()
651 { 714 {
652 $this->logInAs('admin'); 715 $this->logInAs('admin');
716 $this->useTheme('baggy');
653 $client = $this->getClient(); 717 $client = $this->getClient();
654 718
655 $crawler = $client->request('GET', '/all/list'); 719 $crawler = $client->request('GET', '/all/list');
@@ -663,11 +727,22 @@ class EntryControllerTest extends WallabagCoreTestCase
663 $crawler = $client->submit($form, $data); 727 $crawler = $client->submit($form, $data);
664 728
665 $this->assertCount(4, $crawler->filter('div[class=entry]')); 729 $this->assertCount(4, $crawler->filter('div[class=entry]'));
730
731 $entry = new Entry($this->getLoggedInUser());
732 $entry->setUrl($this->url);
733 $entry->setArchived(false);
734 $this->getEntityManager()->persist($entry);
735 $this->getEntityManager()->flush();
736
737 $crawler = $client->submit($form, $data);
738
739 $this->assertCount(5, $crawler->filter('div[class=entry]'));
666 } 740 }
667 741
668 public function testFilterOnCreationDate() 742 public function testFilterOnCreationDate()
669 { 743 {
670 $this->logInAs('admin'); 744 $this->logInAs('admin');
745 $this->useTheme('baggy');
671 $client = $this->getClient(); 746 $client = $this->getClient();
672 747
673 $crawler = $client->request('GET', '/unread/list'); 748 $crawler = $client->request('GET', '/unread/list');
@@ -734,6 +809,7 @@ class EntryControllerTest extends WallabagCoreTestCase
734 public function testFilterOnDomainName() 809 public function testFilterOnDomainName()
735 { 810 {
736 $this->logInAs('admin'); 811 $this->logInAs('admin');
812 $this->useTheme('baggy');
737 $client = $this->getClient(); 813 $client = $this->getClient();
738 814
739 $crawler = $client->request('GET', '/unread/list'); 815 $crawler = $client->request('GET', '/unread/list');
@@ -766,6 +842,7 @@ class EntryControllerTest extends WallabagCoreTestCase
766 public function testFilterOnStatus() 842 public function testFilterOnStatus()
767 { 843 {
768 $this->logInAs('admin'); 844 $this->logInAs('admin');
845 $this->useTheme('baggy');
769 $client = $this->getClient(); 846 $client = $this->getClient();
770 847
771 $crawler = $client->request('GET', '/unread/list'); 848 $crawler = $client->request('GET', '/unread/list');
@@ -784,9 +861,24 @@ class EntryControllerTest extends WallabagCoreTestCase
784 $this->assertCount(1, $crawler->filter('div[class=entry]')); 861 $this->assertCount(1, $crawler->filter('div[class=entry]'));
785 } 862 }
786 863
864 public function testFilterOnIsPublic()
865 {
866 $this->logInAs('admin');
867 $this->useTheme('baggy');
868 $client = $this->getClient();
869
870 $crawler = $client->request('GET', '/unread/list');
871 $form = $crawler->filter('button[id=submit-filter]')->form();
872 $form['entry_filter[isPublic]']->tick();
873
874 $crawler = $client->submit($form);
875 $this->assertCount(0, $crawler->filter('div[class=entry]'));
876 }
877
787 public function testPreviewPictureFilter() 878 public function testPreviewPictureFilter()
788 { 879 {
789 $this->logInAs('admin'); 880 $this->logInAs('admin');
881 $this->useTheme('baggy');
790 $client = $this->getClient(); 882 $client = $this->getClient();
791 883
792 $crawler = $client->request('GET', '/unread/list'); 884 $crawler = $client->request('GET', '/unread/list');
@@ -800,8 +892,15 @@ class EntryControllerTest extends WallabagCoreTestCase
800 public function testFilterOnLanguage() 892 public function testFilterOnLanguage()
801 { 893 {
802 $this->logInAs('admin'); 894 $this->logInAs('admin');
895 $this->useTheme('baggy');
803 $client = $this->getClient(); 896 $client = $this->getClient();
804 897
898 $entry = new Entry($this->getLoggedInUser());
899 $entry->setUrl($this->url);
900 $entry->setLanguage('fr');
901 $this->getEntityManager()->persist($entry);
902 $this->getEntityManager()->flush();
903
805 $crawler = $client->request('GET', '/unread/list'); 904 $crawler = $client->request('GET', '/unread/list');
806 $form = $crawler->filter('button[id=submit-filter]')->form(); 905 $form = $crawler->filter('button[id=submit-filter]')->form();
807 $data = [ 906 $data = [
@@ -809,7 +908,7 @@ class EntryControllerTest extends WallabagCoreTestCase
809 ]; 908 ];
810 909
811 $crawler = $client->submit($form, $data); 910 $crawler = $client->submit($form, $data);
812 $this->assertCount(2, $crawler->filter('div[class=entry]')); 911 $this->assertCount(3, $crawler->filter('div[class=entry]'));
813 912
814 $form = $crawler->filter('button[id=submit-filter]')->form(); 913 $form = $crawler->filter('button[id=submit-filter]')->form();
815 $data = [ 914 $data = [
@@ -825,10 +924,14 @@ class EntryControllerTest extends WallabagCoreTestCase
825 $this->logInAs('admin'); 924 $this->logInAs('admin');
826 $client = $this->getClient(); 925 $client = $this->getClient();
827 926
828 $content = $client->getContainer() 927 // sharing is enabled
829 ->get('doctrine.orm.entity_manager') 928 $client->getContainer()->get('craue_config')->set('share_public', 1);
830 ->getRepository('WallabagCoreBundle:Entry') 929
831 ->findOneByUser($this->getLoggedInUserId()); 930 $content = new Entry($this->getLoggedInUser());
931 $content->setUrl($this->url);
932 $this->getEntityManager()->persist($content);
933 $this->getEntityManager()->flush();
934 $this->getEntityManager()->clear();
832 935
833 // no uid 936 // no uid
834 $client->request('GET', '/share/'.$content->getUid()); 937 $client->request('GET', '/share/'.$content->getUid());
@@ -869,6 +972,7 @@ class EntryControllerTest extends WallabagCoreTestCase
869 972
870 public function testNewEntryWithDownloadImagesEnabled() 973 public function testNewEntryWithDownloadImagesEnabled()
871 { 974 {
975 $this->downloadImagesEnabled = true;
872 $this->logInAs('admin'); 976 $this->logInAs('admin');
873 $client = $this->getClient(); 977 $client = $this->getClient();
874 978
@@ -899,7 +1003,8 @@ class EntryControllerTest extends WallabagCoreTestCase
899 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); 1003 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry);
900 $this->assertEquals($url, $entry->getUrl()); 1004 $this->assertEquals($url, $entry->getUrl());
901 $this->assertContains('Perpignan', $entry->getTitle()); 1005 $this->assertContains('Perpignan', $entry->getTitle());
902 $this->assertContains('/d9bc0fcd.jpeg', $entry->getContent()); 1006 // instead of checking for the filename (which might change) check that the image is now local
1007 $this->assertContains('https://your-wallabag-url-instance.com/assets/images/', $entry->getContent());
903 1008
904 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); 1009 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
905 } 1010 }
@@ -909,12 +1014,27 @@ class EntryControllerTest extends WallabagCoreTestCase
909 */ 1014 */
910 public function testRemoveEntryWithDownloadImagesEnabled() 1015 public function testRemoveEntryWithDownloadImagesEnabled()
911 { 1016 {
1017 $this->downloadImagesEnabled = true;
912 $this->logInAs('admin'); 1018 $this->logInAs('admin');
913 $client = $this->getClient(); 1019 $client = $this->getClient();
914 1020
915 $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route'; 1021 $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route';
916 $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); 1022 $client->getContainer()->get('craue_config')->set('download_images_enabled', 1);
917 1023
1024 $crawler = $client->request('GET', '/new');
1025
1026 $this->assertEquals(200, $client->getResponse()->getStatusCode());
1027
1028 $form = $crawler->filter('form[name=entry]')->form();
1029
1030 $data = [
1031 'entry[url]' => $url,
1032 ];
1033
1034 $client->submit($form, $data);
1035
1036 $this->assertEquals(302, $client->getResponse()->getStatusCode());
1037
918 $content = $client->getContainer() 1038 $content = $client->getContainer()
919 ->get('doctrine.orm.entity_manager') 1039 ->get('doctrine.orm.entity_manager')
920 ->getRepository('WallabagCoreBundle:Entry') 1040 ->getRepository('WallabagCoreBundle:Entry')
@@ -932,28 +1052,19 @@ class EntryControllerTest extends WallabagCoreTestCase
932 $this->logInAs('empty'); 1052 $this->logInAs('empty');
933 $client = $this->getClient(); 1053 $client = $this->getClient();
934 1054
935 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
936 $user = $em
937 ->getRepository('WallabagUserBundle:User')
938 ->find($this->getLoggedInUserId());
939
940 if (!$user) {
941 $this->markTestSkipped('No user found in db.');
942 }
943
944 // Redirect to homepage 1055 // Redirect to homepage
945 $config = $user->getConfig(); 1056 $config = $this->getLoggedInUser()->getConfig();
946 $config->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); 1057 $config->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
947 $em->persist($config); 1058 $this->getEntityManager()->persist($config);
948 $em->flush();
949 1059
950 $content = $client->getContainer() 1060 $entry = new Entry($this->getLoggedInUser());
951 ->get('doctrine.orm.entity_manager') 1061 $entry->setUrl($this->url);
952 ->getRepository('WallabagCoreBundle:Entry') 1062 $this->getEntityManager()->persist($entry);
953 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
954 1063
955 $client->request('GET', '/view/'.$content->getId()); 1064 $this->getEntityManager()->flush();
956 $client->request('GET', '/archive/'.$content->getId()); 1065
1066 $client->request('GET', '/view/'.$entry->getId());
1067 $client->request('GET', '/archive/'.$entry->getId());
957 1068
958 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 1069 $this->assertEquals(302, $client->getResponse()->getStatusCode());
959 $this->assertEquals('/', $client->getResponse()->headers->get('location')); 1070 $this->assertEquals('/', $client->getResponse()->headers->get('location'));
@@ -964,46 +1075,36 @@ class EntryControllerTest extends WallabagCoreTestCase
964 $this->logInAs('empty'); 1075 $this->logInAs('empty');
965 $client = $this->getClient(); 1076 $client = $this->getClient();
966 1077
967 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
968 $user = $em
969 ->getRepository('WallabagUserBundle:User')
970 ->find($this->getLoggedInUserId());
971
972 if (!$user) {
973 $this->markTestSkipped('No user found in db.');
974 }
975
976 // Redirect to current page 1078 // Redirect to current page
977 $config = $user->getConfig(); 1079 $config = $this->getLoggedInUser()->getConfig();
978 $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE); 1080 $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE);
979 $em->persist($config); 1081 $this->getEntityManager()->persist($config);
980 $em->flush();
981 1082
982 $content = $client->getContainer() 1083 $entry = new Entry($this->getLoggedInUser());
983 ->get('doctrine.orm.entity_manager') 1084 $entry->setUrl($this->url);
984 ->getRepository('WallabagCoreBundle:Entry') 1085 $this->getEntityManager()->persist($entry);
985 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
986 1086
987 $client->request('GET', '/view/'.$content->getId()); 1087 $this->getEntityManager()->flush();
988 $client->request('GET', '/archive/'.$content->getId()); 1088
1089 $client->request('GET', '/view/'.$entry->getId());
1090 $client->request('GET', '/archive/'.$entry->getId());
989 1091
990 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 1092 $this->assertEquals(302, $client->getResponse()->getStatusCode());
991 $this->assertContains('/view/'.$content->getId(), $client->getResponse()->headers->get('location')); 1093 $this->assertContains('/view/'.$entry->getId(), $client->getResponse()->headers->get('location'));
992 } 1094 }
993 1095
994 public function testFilterOnHttpStatus() 1096 public function testFilterOnHttpStatus()
995 { 1097 {
996 $this->logInAs('admin'); 1098 $this->logInAs('admin');
1099 $this->useTheme('baggy');
997 $client = $this->getClient(); 1100 $client = $this->getClient();
998 1101
999 $crawler = $client->request('GET', '/new'); 1102 $entry = new Entry($this->getLoggedInUser());
1000 $form = $crawler->filter('form[name=entry]')->form(); 1103 $entry->setUrl('http://www.lemonde.fr/incorrect-url/');
1104 $entry->setHttpStatus(404);
1105 $this->getEntityManager()->persist($entry);
1001 1106
1002 $data = [ 1107 $this->getEntityManager()->flush();
1003 'entry[url]' => 'http://www.lemonde.fr/incorrect-url/',
1004 ];
1005
1006 $client->submit($form, $data);
1007 1108
1008 $crawler = $client->request('GET', '/all/list'); 1109 $crawler = $client->request('GET', '/all/list');
1009 $form = $crawler->filter('button[id=submit-filter]')->form(); 1110 $form = $crawler->filter('button[id=submit-filter]')->form();
@@ -1016,14 +1117,17 @@ class EntryControllerTest extends WallabagCoreTestCase
1016 1117
1017 $this->assertCount(1, $crawler->filter('div[class=entry]')); 1118 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1018 1119
1019 $crawler = $client->request('GET', '/new'); 1120 $entry = new Entry($this->getLoggedInUser());
1020 $form = $crawler->filter('form[name=entry]')->form(); 1121 $entry->setUrl($this->url);
1122 $entry->setHttpStatus(200);
1123 $this->getEntityManager()->persist($entry);
1021 1124
1022 $data = [ 1125 $entry = new Entry($this->getLoggedInUser());
1023 'entry[url]' => 'http://www.nextinpact.com/news/101235-wallabag-alternative-libre-a-pocket-creuse-petit-a-petit-son-nid.htm', 1126 $entry->setUrl('http://www.nextinpact.com/news/101235-wallabag-alternative-libre-a-pocket-creuse-petit-a-petit-son-nid.htm');
1024 ]; 1127 $entry->setHttpStatus(200);
1128 $this->getEntityManager()->persist($entry);
1025 1129
1026 $client->submit($form, $data); 1130 $this->getEntityManager()->flush();
1027 1131
1028 $crawler = $client->request('GET', '/all/list'); 1132 $crawler = $client->request('GET', '/all/list');
1029 $form = $crawler->filter('button[id=submit-filter]')->form(); 1133 $form = $crawler->filter('button[id=submit-filter]')->form();
@@ -1034,7 +1138,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1034 1138
1035 $crawler = $client->submit($form, $data); 1139 $crawler = $client->submit($form, $data);
1036 1140
1037 $this->assertCount(1, $crawler->filter('div[class=entry]')); 1141 $this->assertCount(2, $crawler->filter('div[class=entry]'));
1038 1142
1039 $crawler = $client->request('GET', '/all/list'); 1143 $crawler = $client->request('GET', '/all/list');
1040 $form = $crawler->filter('button[id=submit-filter]')->form(); 1144 $form = $crawler->filter('button[id=submit-filter]')->form();
@@ -1045,14 +1149,21 @@ class EntryControllerTest extends WallabagCoreTestCase
1045 1149
1046 $crawler = $client->submit($form, $data); 1150 $crawler = $client->submit($form, $data);
1047 1151
1048 $this->assertCount(7, $crawler->filter('div[class=entry]')); 1152 $this->assertCount(8, $crawler->filter('div[class=entry]'));
1049 } 1153 }
1050 1154
1051 public function testSearch() 1155 public function testSearch()
1052 { 1156 {
1053 $this->logInAs('admin'); 1157 $this->logInAs('admin');
1158 $this->useTheme('baggy');
1054 $client = $this->getClient(); 1159 $client = $this->getClient();
1055 1160
1161 $entry = new Entry($this->getLoggedInUser());
1162 $entry->setUrl($this->url);
1163 $entry->setTitle('test');
1164 $this->getEntityManager()->persist($entry);
1165 $this->getEntityManager()->flush();
1166
1056 // Search on unread list 1167 // Search on unread list
1057 $crawler = $client->request('GET', '/unread/list'); 1168 $crawler = $client->request('GET', '/unread/list');
1058 1169
@@ -1063,35 +1174,37 @@ class EntryControllerTest extends WallabagCoreTestCase
1063 1174
1064 $crawler = $client->submit($form, $data); 1175 $crawler = $client->submit($form, $data);
1065 1176
1066 $this->assertCount(5, $crawler->filter('div[class=entry]')); 1177 $this->assertCount(4, $crawler->filter('div[class=entry]'));
1067 1178
1068 // Search on starred list 1179 // Search on starred list
1069 $crawler = $client->request('GET', '/starred/list'); 1180 $crawler = $client->request('GET', '/starred/list');
1070 1181
1182 $entry = new Entry($this->getLoggedInUser());
1183 $entry->setUrl('http://localhost/foo/bar');
1184 $entry->setTitle('testeur');
1185 $entry->setStarred(true);
1186 $this->getEntityManager()->persist($entry);
1187 $this->getEntityManager()->flush();
1188
1071 $form = $crawler->filter('form[name=search]')->form(); 1189 $form = $crawler->filter('form[name=search]')->form();
1072 $data = [ 1190 $data = [
1073 'search_entry[term]' => 'title', 1191 'search_entry[term]' => 'testeur',
1074 ]; 1192 ];
1075 1193
1076 $crawler = $client->submit($form, $data); 1194 $crawler = $client->submit($form, $data);
1077 1195
1078 $this->assertCount(1, $crawler->filter('div[class=entry]')); 1196 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1079 1197
1080 // Added new article to test on archive list
1081 $crawler = $client->request('GET', '/new');
1082 $form = $crawler->filter('form[name=entry]')->form();
1083 $data = [
1084 'entry[url]' => $this->url,
1085 ];
1086 $client->submit($form, $data);
1087 $content = $client->getContainer()
1088 ->get('doctrine.orm.entity_manager')
1089 ->getRepository('WallabagCoreBundle:Entry')
1090 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
1091 $client->request('GET', '/archive/'.$content->getId());
1092
1093 $crawler = $client->request('GET', '/archive/list'); 1198 $crawler = $client->request('GET', '/archive/list');
1094 1199
1200 // Added new article to test on archive list
1201 $entry = new Entry($this->getLoggedInUser());
1202 $entry->setUrl('http://0.0.0.0/foo/baz/qux');
1203 $entry->setTitle('Le manège');
1204 $entry->setArchived(true);
1205 $this->getEntityManager()->persist($entry);
1206 $this->getEntityManager()->flush();
1207
1095 $form = $crawler->filter('form[name=search]')->form(); 1208 $form = $crawler->filter('form[name=search]')->form();
1096 $data = [ 1209 $data = [
1097 'search_entry[term]' => 'manège', 1210 'search_entry[term]' => 'manège',
@@ -1100,7 +1213,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1100 $crawler = $client->submit($form, $data); 1213 $crawler = $client->submit($form, $data);
1101 1214
1102 $this->assertCount(1, $crawler->filter('div[class=entry]')); 1215 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1103 $client->request('GET', '/delete/'.$content->getId()); 1216 $client->request('GET', '/delete/'.$entry->getId());
1104 1217
1105 // test on list of all articles 1218 // test on list of all articles
1106 $crawler = $client->request('GET', '/all/list'); 1219 $crawler = $client->request('GET', '/all/list');
@@ -1115,6 +1228,13 @@ class EntryControllerTest extends WallabagCoreTestCase
1115 $this->assertCount(0, $crawler->filter('div[class=entry]')); 1228 $this->assertCount(0, $crawler->filter('div[class=entry]'));
1116 1229
1117 // test url search on list of all articles 1230 // test url search on list of all articles
1231 $entry = new Entry($this->getLoggedInUser());
1232 $entry->setUrl('http://domain/qux');
1233 $entry->setTitle('Le manège');
1234 $entry->setArchived(true);
1235 $this->getEntityManager()->persist($entry);
1236 $this->getEntityManager()->flush();
1237
1118 $crawler = $client->request('GET', '/all/list'); 1238 $crawler = $client->request('GET', '/all/list');
1119 1239
1120 $form = $crawler->filter('form[name=search]')->form(); 1240 $form = $crawler->filter('form[name=search]')->form();
@@ -1138,4 +1258,134 @@ class EntryControllerTest extends WallabagCoreTestCase
1138 1258
1139 $this->assertCount(1, $crawler->filter('div[class=entry]')); 1259 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1140 } 1260 }
1261
1262 public function dataForLanguage()
1263 {
1264 return [
1265 'ru' => [
1266 'https://www.pravda.ru/world/09-06-2017/1337283-qatar-0/',
1267 'ru',
1268 ],
1269 'fr-FR' => [
1270 'http://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/',
1271 'fr_FR',
1272 ],
1273 'de' => [
1274 'http://www.bild.de/politik/ausland/theresa-may/wahlbeben-grossbritannien-analyse-52108924.bild.html',
1275 'de',
1276 ],
1277 'it' => [
1278 'http://www.ansa.it/sito/notizie/mondo/europa/2017/06/08/voto-gb-seggi-aperti-misure-sicurezza-rafforzate_0cb71f7f-e23b-4d5f-95ca-bc12296419f0.html',
1279 'it',
1280 ],
1281 'zh_CN' => [
1282 'http://www.hao123.com/shequ?__noscript__-=1',
1283 'zh_CN',
1284 ],
1285 'de_AT' => [
1286 'https://buy.garmin.com/de-AT/AT/catalog/product/compareResult.ep?compareProduct=112885&compareProduct=36728',
1287 'de_AT',
1288 ],
1289 'ru_RU' => [
1290 'http://netler.ru/ikt/windows-error-reporting.htm',
1291 'ru_RU',
1292 ],
1293 'pt_BR' => [
1294 'http://precodoscombustiveis.com.br/postos/cidade/4121/pr/maringa',
1295 'pt_BR',
1296 ],
1297 'fucked_list_of_languages' => [
1298 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home',
1299 '',
1300 ],
1301 'es-ES' => [
1302 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google',
1303 'es_ES',
1304 ],
1305 ];
1306 }
1307
1308 /**
1309 * @dataProvider dataForLanguage
1310 */
1311 public function testLanguageValidation($url, $expectedLanguage)
1312 {
1313 $this->logInAs('admin');
1314 $client = $this->getClient();
1315
1316 $crawler = $client->request('GET', '/new');
1317
1318 $this->assertEquals(200, $client->getResponse()->getStatusCode());
1319
1320 $form = $crawler->filter('form[name=entry]')->form();
1321
1322 $data = [
1323 'entry[url]' => $url,
1324 ];
1325
1326 $client->submit($form, $data);
1327
1328 $this->assertEquals(302, $client->getResponse()->getStatusCode());
1329
1330 $content = $client->getContainer()
1331 ->get('doctrine.orm.entity_manager')
1332 ->getRepository('WallabagCoreBundle:Entry')
1333 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1334
1335 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
1336 $this->assertEquals($url, $content->getUrl());
1337 $this->assertEquals($expectedLanguage, $content->getLanguage());
1338 }
1339
1340 /**
1341 * This test will require an internet connection.
1342 */
1343 public function testRestrictedArticle()
1344 {
1345 $url = 'http://www.monde-diplomatique.fr/2017/05/BONNET/57475';
1346 $this->logInAs('admin');
1347 $client = $this->getClient();
1348 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
1349
1350 // enable restricted access
1351 $client->getContainer()->get('craue_config')->set('restricted_access', 1);
1352
1353 // create a new site_credential
1354 $user = $client->getContainer()->get('security.token_storage')->getToken()->getUser();
1355 $credential = new SiteCredential($user);
1356 $credential->setHost('monde-diplomatique.fr');
1357 $credential->setUsername($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('foo'));
1358 $credential->setPassword($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
1359
1360 $em->persist($credential);
1361 $em->flush();
1362
1363 $crawler = $client->request('GET', '/new');
1364
1365 $this->assertEquals(200, $client->getResponse()->getStatusCode());
1366
1367 $form = $crawler->filter('form[name=entry]')->form();
1368
1369 $data = [
1370 'entry[url]' => $url,
1371 ];
1372
1373 $client->submit($form, $data);
1374
1375 $this->assertEquals(302, $client->getResponse()->getStatusCode());
1376
1377 $crawler = $client->followRedirect();
1378
1379 $this->assertEquals(200, $client->getResponse()->getStatusCode());
1380 $this->assertContains('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]);
1381
1382 $content = $em
1383 ->getRepository('WallabagCoreBundle:Entry')
1384 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
1385
1386 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
1387 $this->assertSame('Crimes et réformes aux Philippines', $content->getTitle());
1388
1389 $client->getContainer()->get('craue_config')->set('restricted_access', 0);
1390 }
1141} 1391}
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
index 32a18e26..b38961d3 100644
--- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
@@ -189,11 +189,9 @@ class ExportControllerTest extends WallabagCoreTestCase
189 $this->assertContains($contentInDB[0]['language'], $csv[1]); 189 $this->assertContains($contentInDB[0]['language'], $csv[1]);
190 $this->assertContains($contentInDB[0]['createdAt']->format('d/m/Y h:i:s'), $csv[1]); 190 $this->assertContains($contentInDB[0]['createdAt']->format('d/m/Y h:i:s'), $csv[1]);
191 191
192 $expectedTag = [];
193 foreach ($contentInDB[0]['tags'] as $tag) { 192 foreach ($contentInDB[0]['tags'] as $tag) {
194 $expectedTag[] = $tag['label']; 193 $this->assertContains($tag['label'], $csv[1]);
195 } 194 }
196 $this->assertContains(implode(', ', $expectedTag), $csv[1]);
197 } 195 }
198 196
199 public function testJsonExport() 197 public function testJsonExport()
diff --git a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php
index 5a59654d..530c8bbf 100644
--- a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php
@@ -6,7 +6,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6 6
7class RssControllerTest extends WallabagCoreTestCase 7class RssControllerTest extends WallabagCoreTestCase
8{ 8{
9 public function validateDom($xml, $type, $nb = null) 9 public function validateDom($xml, $type, $urlPagination, $nb = null)
10 { 10 {
11 $doc = new \DOMDocument(); 11 $doc = new \DOMDocument();
12 $doc->loadXML($xml); 12 $doc->loadXML($xml);
@@ -23,7 +23,7 @@ class RssControllerTest extends WallabagCoreTestCase
23 $this->assertEquals(1, $xpath->query('/rss/channel')->length); 23 $this->assertEquals(1, $xpath->query('/rss/channel')->length);
24 24
25 $this->assertEquals(1, $xpath->query('/rss/channel/title')->length); 25 $this->assertEquals(1, $xpath->query('/rss/channel/title')->length);
26 $this->assertEquals('wallabag '.$type.' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue); 26 $this->assertEquals('wallabag - '.$type.' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue);
27 27
28 $this->assertEquals(1, $xpath->query('/rss/channel/pubDate')->length); 28 $this->assertEquals(1, $xpath->query('/rss/channel/pubDate')->length);
29 29
@@ -34,10 +34,10 @@ class RssControllerTest extends WallabagCoreTestCase
34 $this->assertEquals('wallabag '.$type.' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue); 34 $this->assertEquals('wallabag '.$type.' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue);
35 35
36 $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="self"]')->length); 36 $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="self"]')->length);
37 $this->assertContains($type.'.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href')); 37 $this->assertContains($urlPagination.'.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href'));
38 38
39 $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="last"]')->length); 39 $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="last"]')->length);
40 $this->assertContains($type.'.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href')); 40 $this->assertContains($urlPagination.'.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href'));
41 41
42 foreach ($xpath->query('//item') as $item) { 42 foreach ($xpath->query('//item') as $item) {
43 $this->assertEquals(1, $xpath->query('title', $item)->length); 43 $this->assertEquals(1, $xpath->query('title', $item)->length);
@@ -94,7 +94,7 @@ class RssControllerTest extends WallabagCoreTestCase
94 94
95 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 95 $this->assertEquals(200, $client->getResponse()->getStatusCode());
96 96
97 $this->validateDom($client->getResponse()->getContent(), 'unread', 2); 97 $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread', 2);
98 } 98 }
99 99
100 public function testStarred() 100 public function testStarred()
@@ -116,7 +116,7 @@ class RssControllerTest extends WallabagCoreTestCase
116 116
117 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 1); 117 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 1);
118 118
119 $this->validateDom($client->getResponse()->getContent(), 'starred'); 119 $this->validateDom($client->getResponse()->getContent(), 'starred', 'starred');
120 } 120 }
121 121
122 public function testArchives() 122 public function testArchives()
@@ -138,7 +138,7 @@ class RssControllerTest extends WallabagCoreTestCase
138 138
139 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 139 $this->assertEquals(200, $client->getResponse()->getStatusCode());
140 140
141 $this->validateDom($client->getResponse()->getContent(), 'archive'); 141 $this->validateDom($client->getResponse()->getContent(), 'archive', 'archive');
142 } 142 }
143 143
144 public function testPagination() 144 public function testPagination()
@@ -159,13 +159,38 @@ class RssControllerTest extends WallabagCoreTestCase
159 159
160 $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); 160 $client->request('GET', '/admin/SUPERTOKEN/unread.xml');
161 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 161 $this->assertEquals(200, $client->getResponse()->getStatusCode());
162 $this->validateDom($client->getResponse()->getContent(), 'unread'); 162 $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread');
163 163
164 $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2'); 164 $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2');
165 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 165 $this->assertEquals(200, $client->getResponse()->getStatusCode());
166 $this->validateDom($client->getResponse()->getContent(), 'unread'); 166 $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread');
167 167
168 $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000'); 168 $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000');
169 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 169 $this->assertEquals(302, $client->getResponse()->getStatusCode());
170 } 170 }
171
172 public function testTags()
173 {
174 $client = $this->getClient();
175 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
176 $user = $em
177 ->getRepository('WallabagUserBundle:User')
178 ->findOneByUsername('admin');
179
180 $config = $user->getConfig();
181 $config->setRssToken('SUPERTOKEN');
182 $config->setRssLimit(null);
183 $em->persist($config);
184 $em->flush();
185
186 $client = $this->getClient();
187 $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml');
188
189 $this->assertEquals(200, $client->getResponse()->getStatusCode());
190
191 $this->validateDom($client->getResponse()->getContent(), 'tag (foo bar)', 'tags/foo-bar');
192
193 $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml?page=3000');
194 $this->assertEquals(302, $client->getResponse()->getStatusCode());
195 }
171} 196}
diff --git a/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php
new file mode 100644
index 00000000..e73a9743
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php
@@ -0,0 +1,139 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Client;
6use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
7use Wallabag\CoreBundle\Entity\SiteCredential;
8
9class SiteCredentialControllerTest extends WallabagCoreTestCase
10{
11 public function testListSiteCredential()
12 {
13 $this->logInAs('admin');
14 $client = $this->getClient();
15
16 $crawler = $client->request('GET', '/site-credentials/');
17
18 $this->assertEquals(200, $client->getResponse()->getStatusCode());
19
20 $body = $crawler->filter('body')->extract(['_text'])[0];
21
22 $this->assertContains('site_credential.description', $body);
23 $this->assertContains('site_credential.list.create_new_one', $body);
24 }
25
26 public function testNewSiteCredential()
27 {
28 $this->logInAs('admin');
29 $client = $this->getClient();
30
31 $crawler = $client->request('GET', '/site-credentials/new');
32
33 $this->assertEquals(200, $client->getResponse()->getStatusCode());
34
35 $body = $crawler->filter('body')->extract(['_text'])[0];
36
37 $this->assertContains('site_credential.new_site_credential', $body);
38 $this->assertContains('site_credential.form.back_to_list', $body);
39
40 $form = $crawler->filter('button[id=site_credential_save]')->form();
41
42 $data = [
43 'site_credential[host]' => 'google.io',
44 'site_credential[username]' => 'sergei',
45 'site_credential[password]' => 'microsoft',
46 ];
47
48 $client->submit($form, $data);
49
50 $this->assertEquals(302, $client->getResponse()->getStatusCode());
51
52 $crawler = $client->followRedirect();
53
54 $this->assertContains('flashes.site_credential.notice.added', $crawler->filter('body')->extract(['_text'])[0]);
55 }
56
57 public function testEditSiteCredential()
58 {
59 $this->logInAs('admin');
60 $client = $this->getClient();
61
62 $credential = $this->createSiteCredential($client);
63
64 $crawler = $client->request('GET', '/site-credentials/'.$credential->getId().'/edit');
65
66 $this->assertEquals(200, $client->getResponse()->getStatusCode());
67
68 $body = $crawler->filter('body')->extract(['_text'])[0];
69
70 $this->assertContains('site_credential.edit_site_credential', $body);
71 $this->assertContains('site_credential.form.back_to_list', $body);
72
73 $form = $crawler->filter('button[id=site_credential_save]')->form();
74
75 $data = [
76 'site_credential[host]' => 'google.io',
77 'site_credential[username]' => 'larry',
78 'site_credential[password]' => 'microsoft',
79 ];
80
81 $client->submit($form, $data);
82
83 $this->assertEquals(302, $client->getResponse()->getStatusCode());
84
85 $crawler = $client->followRedirect();
86
87 $this->assertContains('flashes.site_credential.notice.updated', $crawler->filter('body')->extract(['_text'])[0]);
88 }
89
90 public function testEditFromADifferentUserSiteCredential()
91 {
92 $this->logInAs('admin');
93 $client = $this->getClient();
94
95 $credential = $this->createSiteCredential($client);
96
97 $this->logInAs('bob');
98
99 $client->request('GET', '/site-credentials/'.$credential->getId().'/edit');
100
101 $this->assertEquals(403, $client->getResponse()->getStatusCode());
102 }
103
104 public function testDeleteSiteCredential()
105 {
106 $this->logInAs('admin');
107 $client = $this->getClient();
108
109 $credential = $this->createSiteCredential($client);
110
111 $crawler = $client->request('GET', '/site-credentials/'.$credential->getId().'/edit');
112
113 $this->assertEquals(200, $client->getResponse()->getStatusCode());
114
115 $deleteForm = $crawler->filter('body')->selectButton('site_credential.form.delete')->form();
116
117 $client->submit($deleteForm, []);
118
119 $this->assertEquals(302, $client->getResponse()->getStatusCode());
120
121 $crawler = $client->followRedirect();
122
123 $this->assertContains('flashes.site_credential.notice.deleted', $crawler->filter('body')->extract(['_text'])[0]);
124 }
125
126 private function createSiteCredential(Client $client)
127 {
128 $credential = new SiteCredential($this->getLoggedInUser());
129 $credential->setHost('google.io');
130 $credential->setUsername('sergei');
131 $credential->setPassword('microsoft');
132
133 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
134 $em->persist($credential);
135 $em->flush();
136
137 return $credential;
138 }
139}
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
index fa1a3539..af1ad7af 100644
--- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
@@ -3,6 +3,7 @@
3namespace Tests\Wallabag\CoreBundle\Controller; 3namespace Tests\Wallabag\CoreBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Wallabag\CoreBundle\Entity\Entry;
6use Wallabag\CoreBundle\Entity\Tag; 7use Wallabag\CoreBundle\Entity\Tag;
7 8
8class TagControllerTest extends WallabagCoreTestCase 9class TagControllerTest extends WallabagCoreTestCase
@@ -24,10 +25,11 @@ class TagControllerTest extends WallabagCoreTestCase
24 $this->logInAs('admin'); 25 $this->logInAs('admin');
25 $client = $this->getClient(); 26 $client = $this->getClient();
26 27
27 $entry = $client->getContainer() 28 $entry = new Entry($this->getLoggedInUser());
28 ->get('doctrine.orm.entity_manager') 29 $entry->setUrl('http://0.0.0.0/foo');
29 ->getRepository('WallabagCoreBundle:Entry') 30 $this->getEntityManager()->persist($entry);
30 ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); 31 $this->getEntityManager()->flush();
32 $this->getEntityManager()->clear();
31 33
32 $crawler = $client->request('GET', '/view/'.$entry->getId()); 34 $crawler = $client->request('GET', '/view/'.$entry->getId());
33 35
@@ -41,23 +43,15 @@ class TagControllerTest extends WallabagCoreTestCase
41 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 43 $this->assertEquals(302, $client->getResponse()->getStatusCode());
42 44
43 // be sure to reload the entry 45 // be sure to reload the entry
44 $entry = $client->getContainer() 46 $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
45 ->get('doctrine.orm.entity_manager') 47 $this->assertCount(1, $entry->getTags());
46 ->getRepository('WallabagCoreBundle:Entry')
47 ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId());
48
49 $this->assertEquals(3, count($entry->getTags()));
50 48
51 // tag already exists and already assigned 49 // tag already exists and already assigned
52 $client->submit($form, $data); 50 $client->submit($form, $data);
53 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 51 $this->assertEquals(302, $client->getResponse()->getStatusCode());
54 52
55 $newEntry = $client->getContainer() 53 $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
56 ->get('doctrine.orm.entity_manager') 54 $this->assertCount(1, $entry->getTags());
57 ->getRepository('WallabagCoreBundle:Entry')
58 ->find($entry->getId());
59
60 $this->assertEquals(3, count($newEntry->getTags()));
61 55
62 // tag already exists but still not assigned to this entry 56 // tag already exists but still not assigned to this entry
63 $data = [ 57 $data = [
@@ -67,12 +61,8 @@ class TagControllerTest extends WallabagCoreTestCase
67 $client->submit($form, $data); 61 $client->submit($form, $data);
68 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 62 $this->assertEquals(302, $client->getResponse()->getStatusCode());
69 63
70 $newEntry = $client->getContainer() 64 $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
71 ->get('doctrine.orm.entity_manager') 65 $this->assertCount(2, $entry->getTags());
72 ->getRepository('WallabagCoreBundle:Entry')
73 ->find($entry->getId());
74
75 $this->assertEquals(3, count($newEntry->getTags()));
76 } 66 }
77 67
78 public function testAddMultipleTagToEntry() 68 public function testAddMultipleTagToEntry()
@@ -116,20 +106,25 @@ class TagControllerTest extends WallabagCoreTestCase
116 $this->logInAs('admin'); 106 $this->logInAs('admin');
117 $client = $this->getClient(); 107 $client = $this->getClient();
118 108
119 $entry = $client->getContainer() 109 $tag = new Tag();
120 ->get('doctrine.orm.entity_manager') 110 $tag->setLabel($this->tagName);
121 ->getRepository('WallabagCoreBundle:Entry') 111 $entry = new Entry($this->getLoggedInUser());
122 ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); 112 $entry->setUrl('http://0.0.0.0/foo');
123 113 $entry->addTag($tag);
124 $tag = $client->getContainer() 114 $this->getEntityManager()->persist($entry);
125 ->get('doctrine.orm.entity_manager') 115 $this->getEntityManager()->flush();
126 ->getRepository('WallabagCoreBundle:Tag') 116 $this->getEntityManager()->clear();
127 ->findOneByEntryAndTagLabel($entry, $this->tagName); 117
128 118 // We make a first request to set an history and test redirection after tag deletion
119 $client->request('GET', '/view/'.$entry->getId());
120 $entryUri = $client->getRequest()->getUri();
129 $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); 121 $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId());
130 122
131 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 123 $this->assertEquals(302, $client->getResponse()->getStatusCode());
124 $this->assertEquals($entryUri, $client->getResponse()->getTargetUrl());
132 125
126 // re-retrieve the entry to be sure to get fresh data from database (mostly for tags)
127 $entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
133 $this->assertNotContains($this->tagName, $entry->getTags()); 128 $this->assertNotContains($this->tagName, $entry->getTags());
134 129
135 $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); 130 $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId());
diff --git a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
index aee67259..b0c81e7b 100644
--- a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
+++ b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
@@ -2,12 +2,15 @@
2 2
3namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator; 3namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator;
4 4
5use Monolog\Handler\TestHandler;
6use Monolog\Logger;
5use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; 7use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig;
6use Graby\SiteConfig\SiteConfig as GrabySiteConfig; 8use Graby\SiteConfig\SiteConfig as GrabySiteConfig;
7use PHPUnit_Framework_TestCase;
8use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; 9use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder;
10use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
11use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
9 12
10class GrabySiteConfigBuilderTest extends PHPUnit_Framework_TestCase 13class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase
11{ 14{
12 /** @var \Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder */ 15 /** @var \Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder */
13 protected $builder; 16 protected $builder;
@@ -15,16 +18,16 @@ class GrabySiteConfigBuilderTest extends PHPUnit_Framework_TestCase
15 public function testBuildConfigExists() 18 public function testBuildConfigExists()
16 { 19 {
17 /* @var \Graby\SiteConfig\ConfigBuilder|\PHPUnit_Framework_MockObject_MockObject */ 20 /* @var \Graby\SiteConfig\ConfigBuilder|\PHPUnit_Framework_MockObject_MockObject */
18 $grabyConfigBuilderMock = $this->getMockBuilder('\Graby\SiteConfig\ConfigBuilder') 21 $grabyConfigBuilderMock = $this->getMockBuilder('Graby\SiteConfig\ConfigBuilder')
19 ->disableOriginalConstructor() 22 ->disableOriginalConstructor()
20 ->getMock(); 23 ->getMock();
21 24
22 $grabySiteConfig = new GrabySiteConfig(); 25 $grabySiteConfig = new GrabySiteConfig();
23 $grabySiteConfig->requires_login = true; 26 $grabySiteConfig->requires_login = true;
24 $grabySiteConfig->login_uri = 'http://example.com/login'; 27 $grabySiteConfig->login_uri = 'http://www.example.com/login';
25 $grabySiteConfig->login_username_field = 'login'; 28 $grabySiteConfig->login_username_field = 'login';
26 $grabySiteConfig->login_password_field = 'password'; 29 $grabySiteConfig->login_password_field = 'password';
27 $grabySiteConfig->login_extra_fields = ['field' => 'value']; 30 $grabySiteConfig->login_extra_fields = ['field=value'];
28 $grabySiteConfig->not_logged_in_xpath = '//div[@class="need-login"]'; 31 $grabySiteConfig->not_logged_in_xpath = '//div[@class="need-login"]';
29 32
30 $grabyConfigBuilderMock 33 $grabyConfigBuilderMock
@@ -32,18 +35,44 @@ class GrabySiteConfigBuilderTest extends PHPUnit_Framework_TestCase
32 ->with('example.com') 35 ->with('example.com')
33 ->will($this->returnValue($grabySiteConfig)); 36 ->will($this->returnValue($grabySiteConfig));
34 37
38 $logger = new Logger('foo');
39 $handler = new TestHandler();
40 $logger->pushHandler($handler);
41
42 $siteCrentialRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\SiteCredentialRepository')
43 ->disableOriginalConstructor()
44 ->getMock();
45 $siteCrentialRepo->expects($this->once())
46 ->method('findOneByHostAndUser')
47 ->with('example.com', 1)
48 ->willReturn(['username' => 'foo', 'password' => 'bar']);
49
50 $user = $this->getMockBuilder('Wallabag\UserBundle\Entity\User')
51 ->disableOriginalConstructor()
52 ->getMock();
53 $user->expects($this->once())
54 ->method('getId')
55 ->willReturn(1);
56
57 $token = new UsernamePasswordToken($user, 'pass', 'provider');
58
59 $tokenStorage = new TokenStorage();
60 $tokenStorage->setToken($token);
61
35 $this->builder = new GrabySiteConfigBuilder( 62 $this->builder = new GrabySiteConfigBuilder(
36 $grabyConfigBuilderMock, 63 $grabyConfigBuilderMock,
37 ['example.com' => ['username' => 'foo', 'password' => 'bar']] 64 $tokenStorage,
65 $siteCrentialRepo,
66 $logger
38 ); 67 );
39 68
40 $config = $this->builder->buildForHost('example.com'); 69 $config = $this->builder->buildForHost('www.example.com');
41 70
42 self::assertEquals( 71 $this->assertEquals(
43 new SiteConfig([ 72 new SiteConfig([
44 'host' => 'example.com', 73 'host' => 'example.com',
45 'requiresLogin' => true, 74 'requiresLogin' => true,
46 'loginUri' => 'http://example.com/login', 75 'loginUri' => 'http://www.example.com/login',
47 'usernameField' => 'login', 76 'usernameField' => 'login',
48 'passwordField' => 'password', 77 'passwordField' => 'password',
49 'extraFields' => ['field' => 'value'], 78 'extraFields' => ['field' => 'value'],
@@ -53,6 +82,10 @@ class GrabySiteConfigBuilderTest extends PHPUnit_Framework_TestCase
53 ]), 82 ]),
54 $config 83 $config
55 ); 84 );
85
86 $records = $handler->getRecords();
87
88 $this->assertCount(1, $records, 'One log was recorded');
56 } 89 }
57 90
58 public function testBuildConfigDoesntExist() 91 public function testBuildConfigDoesntExist()
@@ -67,19 +100,43 @@ class GrabySiteConfigBuilderTest extends PHPUnit_Framework_TestCase
67 ->with('unknown.com') 100 ->with('unknown.com')
68 ->will($this->returnValue(new GrabySiteConfig())); 101 ->will($this->returnValue(new GrabySiteConfig()));
69 102
70 $this->builder = new GrabySiteConfigBuilder($grabyConfigBuilderMock, []); 103 $logger = new Logger('foo');
104 $handler = new TestHandler();
105 $logger->pushHandler($handler);
71 106
72 $config = $this->builder->buildForHost('unknown.com'); 107 $siteCrentialRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\SiteCredentialRepository')
108 ->disableOriginalConstructor()
109 ->getMock();
110 $siteCrentialRepo->expects($this->once())
111 ->method('findOneByHostAndUser')
112 ->with('unknown.com', 1)
113 ->willReturn(null);
73 114
74 self::assertEquals( 115 $user = $this->getMockBuilder('Wallabag\UserBundle\Entity\User')
75 new SiteConfig([ 116 ->disableOriginalConstructor()
76 'host' => 'unknown.com', 117 ->getMock();
77 'requiresLogin' => false, 118 $user->expects($this->once())
78 'username' => null, 119 ->method('getId')
79 'password' => null, 120 ->willReturn(1);
80 'extraFields' => [], 121
81 ]), 122 $token = new UsernamePasswordToken($user, 'pass', 'provider');
82 $config 123
124 $tokenStorage = new TokenStorage();
125 $tokenStorage->setToken($token);
126
127 $this->builder = new GrabySiteConfigBuilder(
128 $grabyConfigBuilderMock,
129 $tokenStorage,
130 $siteCrentialRepo,
131 $logger
83 ); 132 );
133
134 $config = $this->builder->buildForHost('unknown.com');
135
136 $this->assertFalse($config);
137
138 $records = $handler->getRecords();
139
140 $this->assertCount(1, $records, 'One log was recorded');
84 } 141 }
85} 142}
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 4f70ed0c..dbddbc5c 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -3,10 +3,17 @@
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Psr\Log\NullLogger; 5use Psr\Log\NullLogger;
6use Monolog\Logger;
7use Monolog\Handler\TestHandler;
6use Wallabag\CoreBundle\Helper\ContentProxy; 8use Wallabag\CoreBundle\Helper\ContentProxy;
7use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\CoreBundle\Entity\Tag; 10use Wallabag\CoreBundle\Entity\Tag;
9use Wallabag\UserBundle\Entity\User; 11use Wallabag\UserBundle\Entity\User;
12use Wallabag\CoreBundle\Helper\RuleBasedTagger;
13use Graby\Graby;
14use Symfony\Component\Validator\Validator\RecursiveValidator;
15use Symfony\Component\Validator\ConstraintViolationList;
16use Symfony\Component\Validator\ConstraintViolation;
10 17
11class ContentProxyTest extends \PHPUnit_Framework_TestCase 18class ContentProxyTest extends \PHPUnit_Framework_TestCase
12{ 19{
@@ -33,8 +40,9 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
33 'language' => '', 40 'language' => '',
34 ]); 41 ]);
35 42
36 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); 43 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
37 $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); 44 $entry = new Entry(new User());
45 $proxy->updateEntry($entry, 'http://user@:80');
38 46
39 $this->assertEquals('http://user@:80', $entry->getUrl()); 47 $this->assertEquals('http://user@:80', $entry->getUrl());
40 $this->assertEmpty($entry->getTitle()); 48 $this->assertEmpty($entry->getTitle());
@@ -67,8 +75,9 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
67 'language' => '', 75 'language' => '',
68 ]); 76 ]);
69 77
70 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); 78 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
71 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 79 $entry = new Entry(new User());
80 $proxy->updateEntry($entry, 'http://0.0.0.0');
72 81
73 $this->assertEquals('http://0.0.0.0', $entry->getUrl()); 82 $this->assertEquals('http://0.0.0.0', $entry->getUrl());
74 $this->assertEmpty($entry->getTitle()); 83 $this->assertEmpty($entry->getTitle());
@@ -106,12 +115,13 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
106 ], 115 ],
107 ]); 116 ]);
108 117
109 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); 118 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
110 $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); 119 $entry = new Entry(new User());
120 $proxy->updateEntry($entry, 'http://domain.io');
111 121
112 $this->assertEquals('http://domain.io', $entry->getUrl()); 122 $this->assertEquals('http://domain.io', $entry->getUrl());
113 $this->assertEquals('my title', $entry->getTitle()); 123 $this->assertEquals('my title', $entry->getTitle());
114 $this->assertEquals($this->fetchingErrorMessage . '<p><i>But we found a short description: </i></p>desc', $entry->getContent()); 124 $this->assertEquals($this->fetchingErrorMessage.'<p><i>But we found a short description: </i></p>desc', $entry->getContent());
115 $this->assertEmpty($entry->getPreviewPicture()); 125 $this->assertEmpty($entry->getPreviewPicture());
116 $this->assertEmpty($entry->getLanguage()); 126 $this->assertEmpty($entry->getLanguage());
117 $this->assertEmpty($entry->getHttpStatus()); 127 $this->assertEmpty($entry->getHttpStatus());
@@ -147,8 +157,9 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
147 ], 157 ],
148 ]); 158 ]);
149 159
150 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); 160 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
151 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 161 $entry = new Entry(new User());
162 $proxy->updateEntry($entry, 'http://0.0.0.0');
152 163
153 $this->assertEquals('http://1.1.1.1', $entry->getUrl()); 164 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
154 $this->assertEquals('this is my title', $entry->getTitle()); 165 $this->assertEquals('this is my title', $entry->getTitle());
@@ -184,12 +195,13 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
184 'open_graph' => [ 195 'open_graph' => [
185 'og_title' => 'my OG title', 196 'og_title' => 'my OG title',
186 'og_description' => 'OG desc', 197 'og_description' => 'OG desc',
187 'og_image' => false, 198 'og_image' => null,
188 ], 199 ],
189 ]); 200 ]);
190 201
191 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); 202 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
192 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 203 $entry = new Entry(new User());
204 $proxy->updateEntry($entry, 'http://0.0.0.0');
193 205
194 $this->assertEquals('http://1.1.1.1', $entry->getUrl()); 206 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
195 $this->assertEquals('this is my title', $entry->getTitle()); 207 $this->assertEquals('this is my title', $entry->getTitle());
@@ -202,187 +214,308 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
202 $this->assertEquals('1.1.1.1', $entry->getDomainName()); 214 $this->assertEquals('1.1.1.1', $entry->getDomainName());
203 } 215 }
204 216
205 public function testWithForcedContent() 217 public function testWithContentAndBadLanguage()
206 { 218 {
207 $tagger = $this->getTaggerMock(); 219 $tagger = $this->getTaggerMock();
208 $tagger->expects($this->once()) 220 $tagger->expects($this->once())
209 ->method('tag'); 221 ->method('tag');
210 222
211 $graby = $this->getMockBuilder('Graby\Graby')->getMock(); 223 $validator = $this->getValidator();
224 $validator->expects($this->exactly(2))
225 ->method('validate')
226 ->will($this->onConsecutiveCalls(
227 new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'language', 'dontexist')]),
228 new ConstraintViolationList()
229 ));
212 230
213 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); 231 $graby = $this->getMockBuilder('Graby\Graby')
214 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ 232 ->setMethods(['fetchContent'])
215 'html' => str_repeat('this is my content', 325), 233 ->disableOriginalConstructor()
216 'title' => 'this is my title', 234 ->getMock();
217 'url' => 'http://1.1.1.1', 235
218 'content_type' => 'text/html', 236 $graby->expects($this->any())
219 'language' => 'fr', 237 ->method('fetchContent')
220 ]); 238 ->willReturn([
239 'html' => str_repeat('this is my content', 325),
240 'title' => 'this is my title',
241 'url' => 'http://1.1.1.1',
242 'content_type' => 'text/html',
243 'language' => 'dontexist',
244 'status' => '200',
245 ]);
246
247 $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage);
248 $entry = new Entry(new User());
249 $proxy->updateEntry($entry, 'http://0.0.0.0');
221 250
222 $this->assertEquals('http://1.1.1.1', $entry->getUrl()); 251 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
223 $this->assertEquals('this is my title', $entry->getTitle()); 252 $this->assertEquals('this is my title', $entry->getTitle());
224 $this->assertContains('this is my content', $entry->getContent()); 253 $this->assertContains('this is my content', $entry->getContent());
225 $this->assertEquals('text/html', $entry->getMimetype()); 254 $this->assertEquals('text/html', $entry->getMimetype());
226 $this->assertEquals('fr', $entry->getLanguage()); 255 $this->assertNull($entry->getLanguage());
256 $this->assertEquals('200', $entry->getHttpStatus());
227 $this->assertEquals(4.0, $entry->getReadingTime()); 257 $this->assertEquals(4.0, $entry->getReadingTime());
228 $this->assertEquals('1.1.1.1', $entry->getDomainName()); 258 $this->assertEquals('1.1.1.1', $entry->getDomainName());
229 } 259 }
230 260
231 public function testTaggerThrowException() 261 public function testWithContentAndBadOgImage()
232 { 262 {
233 $graby = $this->getMockBuilder('Graby\Graby')
234 ->disableOriginalConstructor()
235 ->getMock();
236
237 $tagger = $this->getTaggerMock(); 263 $tagger = $this->getTaggerMock();
238 $tagger->expects($this->once()) 264 $tagger->expects($this->once())
239 ->method('tag') 265 ->method('tag');
240 ->will($this->throwException(new \Exception()));
241
242 $tagRepo = $this->getTagRepositoryMock();
243 $proxy = new ContentProxy($graby, $tagger, $tagRepo, $this->getLogger(), $this->fetchingErrorMessage);
244
245 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [
246 'html' => str_repeat('this is my content', 325),
247 'title' => 'this is my title',
248 'url' => 'http://1.1.1.1',
249 'content_type' => 'text/html',
250 'language' => 'fr',
251 ]);
252 266
253 $this->assertCount(0, $entry->getTags()); 267 $validator = $this->getValidator();
254 } 268 $validator->expects($this->exactly(2))
269 ->method('validate')
270 ->will($this->onConsecutiveCalls(
271 new ConstraintViolationList(),
272 new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'url', 'https://')])
273 ));
255 274
256 public function testAssignTagsWithArrayAndExtraSpaces()
257 {
258 $graby = $this->getMockBuilder('Graby\Graby') 275 $graby = $this->getMockBuilder('Graby\Graby')
276 ->setMethods(['fetchContent'])
259 ->disableOriginalConstructor() 277 ->disableOriginalConstructor()
260 ->getMock(); 278 ->getMock();
261 279
262 $tagRepo = $this->getTagRepositoryMock(); 280 $graby->expects($this->any())
263 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); 281 ->method('fetchContent')
282 ->willReturn([
283 'html' => str_repeat('this is my content', 325),
284 'title' => 'this is my title',
285 'url' => 'http://1.1.1.1',
286 'content_type' => 'text/html',
287 'language' => 'fr',
288 'status' => '200',
289 'open_graph' => [
290 'og_title' => 'my OG title',
291 'og_description' => 'OG desc',
292 'og_image' => 'https://',
293 ],
294 ]);
264 295
296 $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage);
265 $entry = new Entry(new User()); 297 $entry = new Entry(new User());
298 $proxy->updateEntry($entry, 'http://0.0.0.0');
266 299
267 $proxy->assignTagsToEntry($entry, [' tag1', 'tag2 ']); 300 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
268 301 $this->assertEquals('this is my title', $entry->getTitle());
269 $this->assertCount(2, $entry->getTags()); 302 $this->assertContains('this is my content', $entry->getContent());
270 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); 303 $this->assertNull($entry->getPreviewPicture());
271 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); 304 $this->assertEquals('text/html', $entry->getMimetype());
305 $this->assertEquals('fr', $entry->getLanguage());
306 $this->assertEquals('200', $entry->getHttpStatus());
307 $this->assertEquals(4.0, $entry->getReadingTime());
308 $this->assertEquals('1.1.1.1', $entry->getDomainName());
272 } 309 }
273 310
274 public function testAssignTagsWithString() 311 public function testWithForcedContent()
275 { 312 {
276 $graby = $this->getMockBuilder('Graby\Graby') 313 $tagger = $this->getTaggerMock();
277 ->disableOriginalConstructor() 314 $tagger->expects($this->once())
278 ->getMock(); 315 ->method('tag');
279
280 $tagRepo = $this->getTagRepositoryMock();
281 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage);
282 316
317 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
283 $entry = new Entry(new User()); 318 $entry = new Entry(new User());
319 $proxy->updateEntry(
320 $entry,
321 'http://0.0.0.0',
322 [
323 'html' => str_repeat('this is my content', 325),
324 'title' => 'this is my title',
325 'url' => 'http://1.1.1.1',
326 'content_type' => 'text/html',
327 'language' => 'fr',
328 'date' => '1395635872',
329 'authors' => ['Jeremy', 'Nico', 'Thomas'],
330 'all_headers' => [
331 'Cache-Control' => 'no-cache',
332 ],
333 ]
334 );
284 335
285 $proxy->assignTagsToEntry($entry, 'tag1, tag2'); 336 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
286 337 $this->assertEquals('this is my title', $entry->getTitle());
287 $this->assertCount(2, $entry->getTags()); 338 $this->assertContains('this is my content', $entry->getContent());
288 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); 339 $this->assertEquals('text/html', $entry->getMimetype());
289 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); 340 $this->assertEquals('fr', $entry->getLanguage());
341 $this->assertEquals(4.0, $entry->getReadingTime());
342 $this->assertEquals('1.1.1.1', $entry->getDomainName());
343 $this->assertEquals('24/03/2014', $entry->getPublishedAt()->format('d/m/Y'));
344 $this->assertContains('Jeremy', $entry->getPublishedBy());
345 $this->assertContains('Nico', $entry->getPublishedBy());
346 $this->assertContains('Thomas', $entry->getPublishedBy());
347 $this->assertContains('no-cache', $entry->getHeaders());
290 } 348 }
291 349
292 public function testAssignTagsWithEmptyArray() 350 public function testWithForcedContentAndDatetime()
293 { 351 {
294 $graby = $this->getMockBuilder('Graby\Graby') 352 $tagger = $this->getTaggerMock();
295 ->disableOriginalConstructor() 353 $tagger->expects($this->once())
296 ->getMock(); 354 ->method('tag');
297 355
298 $tagRepo = $this->getTagRepositoryMock(); 356 $logHandler = new TestHandler();
299 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); 357 $logger = new Logger('test', [$logHandler]);
300 358
359 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage);
301 $entry = new Entry(new User()); 360 $entry = new Entry(new User());
361 $proxy->updateEntry(
362 $entry,
363 'http://1.1.1.1',
364 [
365 'html' => str_repeat('this is my content', 325),
366 'title' => 'this is my title',
367 'url' => 'http://1.1.1.1',
368 'content_type' => 'text/html',
369 'language' => 'fr',
370 'date' => '2016-09-08T11:55:58+0200',
371 ]
372 );
302 373
303 $proxy->assignTagsToEntry($entry, []); 374 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
304 375 $this->assertEquals('this is my title', $entry->getTitle());
305 $this->assertCount(0, $entry->getTags()); 376 $this->assertContains('this is my content', $entry->getContent());
377 $this->assertEquals('text/html', $entry->getMimetype());
378 $this->assertEquals('fr', $entry->getLanguage());
379 $this->assertEquals(4.0, $entry->getReadingTime());
380 $this->assertEquals('1.1.1.1', $entry->getDomainName());
381 $this->assertEquals('08/09/2016', $entry->getPublishedAt()->format('d/m/Y'));
306 } 382 }
307 383
308 public function testAssignTagsWithEmptyString() 384 public function testWithForcedContentAndBadDate()
309 { 385 {
310 $graby = $this->getMockBuilder('Graby\Graby') 386 $tagger = $this->getTaggerMock();
311 ->disableOriginalConstructor() 387 $tagger->expects($this->once())
312 ->getMock(); 388 ->method('tag');
313 389
314 $tagRepo = $this->getTagRepositoryMock(); 390 $logger = new Logger('foo');
315 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); 391 $handler = new TestHandler();
392 $logger->pushHandler($handler);
316 393
394 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage);
317 $entry = new Entry(new User()); 395 $entry = new Entry(new User());
396 $proxy->updateEntry(
397 $entry,
398 'http://1.1.1.1',
399 [
400 'html' => str_repeat('this is my content', 325),
401 'title' => 'this is my title',
402 'url' => 'http://1.1.1.1',
403 'content_type' => 'text/html',
404 'language' => 'fr',
405 'date' => '01 02 2012',
406 ]
407 );
408
409 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
410 $this->assertEquals('this is my title', $entry->getTitle());
411 $this->assertContains('this is my content', $entry->getContent());
412 $this->assertEquals('text/html', $entry->getMimetype());
413 $this->assertEquals('fr', $entry->getLanguage());
414 $this->assertEquals(4.0, $entry->getReadingTime());
415 $this->assertEquals('1.1.1.1', $entry->getDomainName());
416 $this->assertNull($entry->getPublishedAt());
318 417
319 $proxy->assignTagsToEntry($entry, ''); 418 $records = $handler->getRecords();
320 419
321 $this->assertCount(0, $entry->getTags()); 420 $this->assertCount(1, $records);
421 $this->assertContains('Error while defining date', $records[0]['message']);
322 } 422 }
323 423
324 public function testAssignTagsAlreadyAssigned() 424 public function testTaggerThrowException()
325 { 425 {
326 $graby = $this->getMockBuilder('Graby\Graby') 426 $tagger = $this->getTaggerMock();
327 ->disableOriginalConstructor() 427 $tagger->expects($this->once())
328 ->getMock(); 428 ->method('tag')
329 429 ->will($this->throwException(new \Exception()));
330 $tagRepo = $this->getTagRepositoryMock();
331 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage);
332
333 $tagEntity = new Tag();
334 $tagEntity->setLabel('tag1');
335 430
431 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
336 $entry = new Entry(new User()); 432 $entry = new Entry(new User());
337 $entry->addTag($tagEntity); 433 $proxy->updateEntry(
338 434 $entry,
339 $proxy->assignTagsToEntry($entry, 'tag1, tag2'); 435 'http://1.1.1.1',
436 [
437 'html' => str_repeat('this is my content', 325),
438 'title' => 'this is my title',
439 'url' => 'http://1.1.1.1',
440 'content_type' => 'text/html',
441 'language' => 'fr',
442 ]
443 );
340 444
341 $this->assertCount(2, $entry->getTags()); 445 $this->assertCount(0, $entry->getTags());
342 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
343 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel());
344 } 446 }
345 447
346 public function testAssignTagsNotFlushed() 448 public function dataForCrazyHtml()
347 { 449 {
348 $graby = $this->getMockBuilder('Graby\Graby') 450 return [
349 ->disableOriginalConstructor() 451 'script and comment' => [
350 ->getMock(); 452 '<strong>Script inside:</strong> <!--[if gte IE 4]><script>alert(\'lol\');</script><![endif]--><br />',
351 453 'lol',
352 $tagRepo = $this->getTagRepositoryMock(); 454 ],
353 $tagRepo->expects($this->never()) 455 'script' => [
354 ->method('__call'); 456 '<strong>Script inside:</strong><script>alert(\'lol\');</script>',
355 457 'script',
356 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); 458 ],
459 ];
460 }
357 461
358 $tagEntity = new Tag(); 462 /**
359 $tagEntity->setLabel('tag1'); 463 * @dataProvider dataForCrazyHtml
464 */
465 public function testWithCrazyHtmlContent($html, $escapedString)
466 {
467 $tagger = $this->getTaggerMock();
468 $tagger->expects($this->once())
469 ->method('tag');
360 470
471 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
361 $entry = new Entry(new User()); 472 $entry = new Entry(new User());
473 $proxy->updateEntry(
474 $entry,
475 'http://1.1.1.1',
476 [
477 'html' => $html,
478 'title' => 'this is my title',
479 'url' => 'http://1.1.1.1',
480 'content_type' => 'text/html',
481 'language' => 'fr',
482 'status' => '200',
483 'open_graph' => [
484 'og_title' => 'my OG title',
485 'og_description' => 'OG desc',
486 'og_image' => 'http://3.3.3.3/cover.jpg',
487 ],
488 ]
489 );
362 490
363 $proxy->assignTagsToEntry($entry, 'tag1', [$tagEntity]); 491 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
364 492 $this->assertEquals('this is my title', $entry->getTitle());
365 $this->assertCount(1, $entry->getTags()); 493 $this->assertNotContains($escapedString, $entry->getContent());
366 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); 494 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture());
495 $this->assertEquals('text/html', $entry->getMimetype());
496 $this->assertEquals('fr', $entry->getLanguage());
497 $this->assertEquals('200', $entry->getHttpStatus());
498 $this->assertEquals('1.1.1.1', $entry->getDomainName());
367 } 499 }
368 500
369 private function getTaggerMock() 501 private function getTaggerMock()
370 { 502 {
371 return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') 503 return $this->getMockBuilder(RuleBasedTagger::class)
372 ->setMethods(['tag']) 504 ->setMethods(['tag'])
373 ->disableOriginalConstructor() 505 ->disableOriginalConstructor()
374 ->getMock(); 506 ->getMock();
375 } 507 }
376 508
377 private function getTagRepositoryMock() 509 private function getLogger()
378 { 510 {
379 return $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository') 511 return new NullLogger();
380 ->disableOriginalConstructor()
381 ->getMock();
382 } 512 }
383 513
384 private function getLogger() 514 private function getValidator()
385 { 515 {
386 return new NullLogger(); 516 return $this->getMockBuilder(RecursiveValidator::class)
517 ->setMethods(['validate'])
518 ->disableOriginalConstructor()
519 ->getMock();
387 } 520 }
388} 521}
diff --git a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php
new file mode 100644
index 00000000..cede8696
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php
@@ -0,0 +1,40 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Helper;
4
5use Psr\Log\NullLogger;
6use Monolog\Logger;
7use Monolog\Handler\TestHandler;
8use Wallabag\CoreBundle\Helper\CryptoProxy;
9
10class CryptoProxyTest extends \PHPUnit_Framework_TestCase
11{
12 public function testCrypto()
13 {
14 $logHandler = new TestHandler();
15 $logger = new Logger('test', [$logHandler]);
16
17 $crypto = new CryptoProxy(sys_get_temp_dir().'/'.uniqid('', true).'.txt', $logger);
18 $crypted = $crypto->crypt('test');
19 $decrypted = $crypto->decrypt($crypted);
20
21 $this->assertSame('test', $decrypted);
22
23 $records = $logHandler->getRecords();
24 $this->assertCount(2, $records);
25 $this->assertContains('Crypto: crypting value', $records[0]['message']);
26 $this->assertContains('Crypto: decrypting value', $records[1]['message']);
27 }
28
29 /**
30 * @expectedException RuntimeException
31 * @expectedExceptionMessage Decrypt fail
32 *
33 * @return [type] [description]
34 */
35 public function testDecryptBadValue()
36 {
37 $crypto = new CryptoProxy(sys_get_temp_dir().'/'.uniqid('', true).'.txt', new NullLogger());
38 $crypto->decrypt('badvalue');
39 }
40}
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
index 85f12d87..c02f9658 100644
--- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
@@ -12,7 +12,24 @@ use GuzzleHttp\Stream\Stream;
12 12
13class DownloadImagesTest extends \PHPUnit_Framework_TestCase 13class DownloadImagesTest extends \PHPUnit_Framework_TestCase
14{ 14{
15 public function testProcessHtml() 15 public function dataForSuccessImage()
16 {
17 return [
18 'imgur' => [
19 '<div><img src="http://i.imgur.com/T9qgcHc.jpg" /></div>',
20 'http://imgur.com/gallery/WxtWY',
21 ],
22 'image with &' => [
23 '<div><img src="https://i2.wp.com/www.tvaddons.ag/wp-content/uploads/2017/01/Screen-Shot-2017-01-07-at-10.17.40-PM.jpg?w=640&amp;ssl=1" /></div>',
24 'https://www.tvaddons.ag/realdebrid-kodi-jarvis/',
25 ],
26 ];
27 }
28
29 /**
30 * @dataProvider dataForSuccessImage
31 */
32 public function testProcessHtml($html, $url)
16 { 33 {
17 $client = new Client(); 34 $client = new Client();
18 35
@@ -27,9 +44,10 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase
27 44
28 $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); 45 $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger);
29 46
30 $res = $download->processHtml(123, '<div><img src="http://i.imgur.com/T9qgcHc.jpg" /></div>', 'http://imgur.com/gallery/WxtWY'); 47 $res = $download->processHtml(123, $html, $url);
31 48
32 $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/c638b4c2.png', $res); 49 // this the base path of all image (since it's calculated using the entry id: 123)
50 $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/', $res);
33 } 51 }
34 52
35 public function testProcessHtmlWithBadImage() 53 public function testProcessHtmlWithBadImage()
@@ -139,4 +157,29 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase
139 157
140 $this->assertFalse($res, 'Absolute image can not be determined, so it will not be replaced'); 158 $this->assertFalse($res, 'Absolute image can not be determined, so it will not be replaced');
141 } 159 }
160
161 public function testProcessRealImage()
162 {
163 $client = new Client();
164
165 $mock = new Mock([
166 new Response(200, ['content-type' => null], Stream::factory(file_get_contents(__DIR__.'/../fixtures/image-no-content-type.jpg'))),
167 ]);
168
169 $client->getEmitter()->attach($mock);
170
171 $logHandler = new TestHandler();
172 $logger = new Logger('test', array($logHandler));
173
174 $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger);
175
176 $res = $download->processSingleImage(
177 123,
178 'https://cdn.theconversation.com/files/157200/article/width926/gsj2rjp2-1487348607.jpg',
179 'https://theconversation.com/conversation-avec-gerald-bronner-ce-nest-pas-la-post-verite-qui-nous-menace-mais-lextension-de-notre-credulite-73089'
180 );
181
182 $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/', $res, 'Content-Type was empty but data is ok for an image');
183 $this->assertContains('DownloadImages: Checking extension (alternative)', $logHandler->getRecords()[3]['message']);
184 }
142} 185}
diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
index 0539f20a..f420d06a 100644
--- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
@@ -89,4 +89,22 @@ class RedirectTest extends \PHPUnit_Framework_TestCase
89 89
90 $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); 90 $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl);
91 } 91 }
92
93 public function testUserForRedirectWithIgnoreActionMarkAsRead()
94 {
95 $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
96
97 $redirectUrl = $this->redirect->to('/unread/list', '', true);
98
99 $this->assertEquals('/unread/list', $redirectUrl);
100 }
101
102 public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead()
103 {
104 $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
105
106 $redirectUrl = $this->redirect->to(null, 'fallback', true);
107
108 $this->assertEquals('fallback', $redirectUrl);
109 }
92} 110}
diff --git a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
index 17b08c2a..1e21f400 100644
--- a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
@@ -2,6 +2,8 @@
2 2
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Monolog\Handler\TestHandler;
6use Monolog\Logger;
5use Wallabag\CoreBundle\Entity\Config; 7use Wallabag\CoreBundle\Entity\Config;
6use Wallabag\CoreBundle\Entity\Entry; 8use Wallabag\CoreBundle\Entity\Entry;
7use Wallabag\CoreBundle\Entity\Tag; 9use Wallabag\CoreBundle\Entity\Tag;
@@ -15,14 +17,19 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
15 private $tagRepository; 17 private $tagRepository;
16 private $entryRepository; 18 private $entryRepository;
17 private $tagger; 19 private $tagger;
20 private $logger;
21 private $handler;
18 22
19 public function setUp() 23 public function setUp()
20 { 24 {
21 $this->rulerz = $this->getRulerZMock(); 25 $this->rulerz = $this->getRulerZMock();
22 $this->tagRepository = $this->getTagRepositoryMock(); 26 $this->tagRepository = $this->getTagRepositoryMock();
23 $this->entryRepository = $this->getEntryRepositoryMock(); 27 $this->entryRepository = $this->getEntryRepositoryMock();
28 $this->logger = $this->getLogger();
29 $this->handler = new TestHandler();
30 $this->logger->pushHandler($this->handler);
24 31
25 $this->tagger = new RuleBasedTagger($this->rulerz, $this->tagRepository, $this->entryRepository); 32 $this->tagger = new RuleBasedTagger($this->rulerz, $this->tagRepository, $this->entryRepository, $this->logger);
26 } 33 }
27 34
28 public function testTagWithNoRule() 35 public function testTagWithNoRule()
@@ -32,6 +39,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
32 $this->tagger->tag($entry); 39 $this->tagger->tag($entry);
33 40
34 $this->assertTrue($entry->getTags()->isEmpty()); 41 $this->assertTrue($entry->getTags()->isEmpty());
42 $records = $this->handler->getRecords();
43 $this->assertCount(0, $records);
35 } 44 }
36 45
37 public function testTagWithNoMatchingRule() 46 public function testTagWithNoMatchingRule()
@@ -49,6 +58,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
49 $this->tagger->tag($entry); 58 $this->tagger->tag($entry);
50 59
51 $this->assertTrue($entry->getTags()->isEmpty()); 60 $this->assertTrue($entry->getTags()->isEmpty());
61 $records = $this->handler->getRecords();
62 $this->assertCount(0, $records);
52 } 63 }
53 64
54 public function testTagWithAMatchingRule() 65 public function testTagWithAMatchingRule()
@@ -70,6 +81,9 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
70 $tags = $entry->getTags(); 81 $tags = $entry->getTags();
71 $this->assertSame('foo', $tags[0]->getLabel()); 82 $this->assertSame('foo', $tags[0]->getLabel());
72 $this->assertSame('bar', $tags[1]->getLabel()); 83 $this->assertSame('bar', $tags[1]->getLabel());
84
85 $records = $this->handler->getRecords();
86 $this->assertCount(1, $records);
73 } 87 }
74 88
75 public function testTagWithAMixOfMatchingRules() 89 public function testTagWithAMixOfMatchingRules()
@@ -90,6 +104,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
90 104
91 $tags = $entry->getTags(); 105 $tags = $entry->getTags();
92 $this->assertSame('foo', $tags[0]->getLabel()); 106 $this->assertSame('foo', $tags[0]->getLabel());
107 $records = $this->handler->getRecords();
108 $this->assertCount(1, $records);
93 } 109 }
94 110
95 public function testWhenTheTagExists() 111 public function testWhenTheTagExists()
@@ -118,6 +134,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
118 134
119 $tags = $entry->getTags(); 135 $tags = $entry->getTags();
120 $this->assertSame($tag, $tags[0]); 136 $this->assertSame($tag, $tags[0]);
137 $records = $this->handler->getRecords();
138 $this->assertCount(1, $records);
121 } 139 }
122 140
123 public function testSameTagWithDifferentfMatchingRules() 141 public function testSameTagWithDifferentfMatchingRules()
@@ -138,6 +156,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
138 156
139 $tags = $entry->getTags(); 157 $tags = $entry->getTags();
140 $this->assertCount(1, $tags); 158 $this->assertCount(1, $tags);
159 $records = $this->handler->getRecords();
160 $this->assertCount(2, $records);
141 } 161 }
142 162
143 public function testTagAllEntriesForAUser() 163 public function testTagAllEntriesForAUser()
@@ -209,4 +229,9 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
209 ->disableOriginalConstructor() 229 ->disableOriginalConstructor()
210 ->getMock(); 230 ->getMock();
211 } 231 }
232
233 private function getLogger()
234 {
235 return new Logger('foo');
236 }
212} 237}
diff --git a/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php
new file mode 100644
index 00000000..6d6d6484
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php
@@ -0,0 +1,108 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Helper;
4
5use Wallabag\CoreBundle\Entity\Entry;
6use Wallabag\CoreBundle\Entity\Tag;
7use Wallabag\CoreBundle\Helper\TagsAssigner;
8use Wallabag\UserBundle\Entity\User;
9use Wallabag\CoreBundle\Repository\TagRepository;
10
11class TagsAssignerTest extends \PHPUnit_Framework_TestCase
12{
13 public function testAssignTagsWithArrayAndExtraSpaces()
14 {
15 $tagRepo = $this->getTagRepositoryMock();
16 $tagsAssigner = new TagsAssigner($tagRepo);
17
18 $entry = new Entry(new User());
19
20 $tagsAssigner->assignTagsToEntry($entry, [' tag1', 'tag2 ']);
21
22 $this->assertCount(2, $entry->getTags());
23 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
24 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel());
25 }
26
27 public function testAssignTagsWithString()
28 {
29 $tagRepo = $this->getTagRepositoryMock();
30 $tagsAssigner = new TagsAssigner($tagRepo);
31
32 $entry = new Entry(new User());
33
34 $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2');
35
36 $this->assertCount(2, $entry->getTags());
37 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
38 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel());
39 }
40
41 public function testAssignTagsWithEmptyArray()
42 {
43 $tagRepo = $this->getTagRepositoryMock();
44 $tagsAssigner = new TagsAssigner($tagRepo);
45
46 $entry = new Entry(new User());
47
48 $tagsAssigner->assignTagsToEntry($entry, []);
49
50 $this->assertCount(0, $entry->getTags());
51 }
52
53 public function testAssignTagsWithEmptyString()
54 {
55 $tagRepo = $this->getTagRepositoryMock();
56 $tagsAssigner = new TagsAssigner($tagRepo);
57
58 $entry = new Entry(new User());
59
60 $tagsAssigner->assignTagsToEntry($entry, '');
61
62 $this->assertCount(0, $entry->getTags());
63 }
64
65 public function testAssignTagsAlreadyAssigned()
66 {
67 $tagRepo = $this->getTagRepositoryMock();
68 $tagsAssigner = new TagsAssigner($tagRepo);
69
70 $tagEntity = new Tag();
71 $tagEntity->setLabel('tag1');
72
73 $entry = new Entry(new User());
74 $entry->addTag($tagEntity);
75
76 $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2');
77
78 $this->assertCount(2, $entry->getTags());
79 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
80 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel());
81 }
82
83 public function testAssignTagsNotFlushed()
84 {
85 $tagRepo = $this->getTagRepositoryMock();
86 $tagRepo->expects($this->never())
87 ->method('__call');
88
89 $tagsAssigner = new TagsAssigner($tagRepo);
90
91 $tagEntity = new Tag();
92 $tagEntity->setLabel('tag1');
93
94 $entry = new Entry(new User());
95
96 $tagsAssigner->assignTagsToEntry($entry, 'tag1', [$tagEntity]);
97
98 $this->assertCount(1, $entry->getTags());
99 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
100 }
101
102 private function getTagRepositoryMock()
103 {
104 return $this->getMockBuilder(TagRepository::class)
105 ->disableOriginalConstructor()
106 ->getMock();
107 }
108}
diff --git a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php
index 2e6fccfb..ca8e0d50 100644
--- a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php
+++ b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php
@@ -136,7 +136,7 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
136 } 136 }
137 137
138 /** 138 /**
139 * @expectedException Symfony\Component\HttpKernel\Exception\NotFoundHttpException 139 * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
140 * @expectedExceptionMessage User not found 140 * @expectedExceptionMessage User not found
141 */ 141 */
142 public function testApplyUserNotFound() 142 public function testApplyUserNotFound()
diff --git a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php
index 7bf4b43c..eec6939d 100644
--- a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php
+++ b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php
@@ -2,11 +2,20 @@
2 2
3namespace Tests\Wallabag\CoreBundle; 3namespace Tests\Wallabag\CoreBundle;
4 4
5use Symfony\Bundle\FrameworkBundle\Client;
6use Symfony\Bundle\FrameworkBundle\Console\Application;
5use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; 7use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6use Symfony\Component\BrowserKit\Cookie; 8use Symfony\Component\BrowserKit\Cookie;
9use Symfony\Component\Console\Input\ArrayInput;
10use Symfony\Component\Console\Output\NullOutput;
11use Wallabag\CoreBundle\Entity\Config;
12use Wallabag\UserBundle\Entity\User;
7 13
8abstract class WallabagCoreTestCase extends WebTestCase 14abstract class WallabagCoreTestCase extends WebTestCase
9{ 15{
16 /**
17 * @var Client|null
18 */
10 private $client = null; 19 private $client = null;
11 20
12 public function getClient() 21 public function getClient()
@@ -21,6 +30,44 @@ abstract class WallabagCoreTestCase extends WebTestCase
21 $this->client = static::createClient(); 30 $this->client = static::createClient();
22 } 31 }
23 32
33 public function resetDatabase(Client $client)
34 {
35 $application = new Application($client->getKernel());
36 $application->setAutoExit(false);
37
38 $application->run(new ArrayInput([
39 'command' => 'doctrine:schema:drop',
40 '--no-interaction' => true,
41 '--force' => true,
42 '--env' => 'test',
43 ]), new NullOutput());
44
45 $application->run(new ArrayInput([
46 'command' => 'doctrine:schema:create',
47 '--no-interaction' => true,
48 '--env' => 'test',
49 ]), new NullOutput());
50
51 $application->run(new ArrayInput([
52 'command' => 'doctrine:fixtures:load',
53 '--no-interaction' => true,
54 '--env' => 'test',
55 ]), new NullOutput());
56
57 /*
58 * Recreate client to avoid error:
59 *
60 * [Doctrine\DBAL\ConnectionException]
61 * Transaction commit failed because the transaction has been marked for rollback only.
62 */
63 $this->client = static::createClient();
64 }
65
66 public function getEntityManager()
67 {
68 return $this->client->getContainer()->get('doctrine.orm.entity_manager');
69 }
70
24 /** 71 /**
25 * Login a user without making a HTTP request. 72 * Login a user without making a HTTP request.
26 * If we make a HTTP request we lose ability to mock service in the container. 73 * If we make a HTTP request we lose ability to mock service in the container.
@@ -37,7 +84,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
37 $firewallName = $container->getParameter('fos_user.firewall_name'); 84 $firewallName = $container->getParameter('fos_user.firewall_name');
38 85
39 $user = $userManager->findUserBy(array('username' => $username)); 86 $user = $userManager->findUserBy(array('username' => $username));
40 $loginManager->loginUser($firewallName, $user); 87 $loginManager->logInUser($firewallName, $user);
41 88
42 $session->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); 89 $session->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken()));
43 $session->save(); 90 $session->save();
@@ -65,23 +112,42 @@ abstract class WallabagCoreTestCase extends WebTestCase
65 } 112 }
66 113
67 /** 114 /**
68 * Return the user id of the logged in user. 115 * Return the user of the logged in user.
69 * You should be sure that you called `logInAs` before. 116 * You should be sure that you called `logInAs` before.
70 * 117 *
71 * @return int 118 * @return User
72 */ 119 */
73 public function getLoggedInUserId() 120 public function getLoggedInUser()
74 { 121 {
75 $token = static::$kernel->getContainer()->get('security.token_storage')->getToken(); 122 $token = static::$kernel->getContainer()->get('security.token_storage')->getToken();
76 123
77 if (null !== $token) { 124 if (null !== $token) {
78 return $token->getUser()->getId(); 125 return $token->getUser();
79 } 126 }
80 127
81 throw new \RuntimeException('No logged in User.'); 128 throw new \RuntimeException('No logged in User.');
82 } 129 }
83 130
84 /** 131 /**
132 * Return the user id of the logged in user.
133 * You should be sure that you called `logInAs` before.
134 *
135 * @return int
136 */
137 public function getLoggedInUserId()
138 {
139 return $this->getLoggedInUser()->getId();
140 }
141
142 public function useTheme($theme)
143 {
144 $config = $this->getEntityManager()->getRepository(Config::class)->findOneByUser($this->getLoggedInUser());
145 $config->setTheme($theme);
146 $this->getEntityManager()->persist($config);
147 $this->getEntityManager()->flush();
148 }
149
150 /**
85 * Check if Redis is installed. 151 * Check if Redis is installed.
86 * If not, mark test as skip. 152 * If not, mark test as skip.
87 */ 153 */
diff --git a/tests/Wallabag/CoreBundle/fixtures/image-no-content-type.jpg b/tests/Wallabag/CoreBundle/fixtures/image-no-content-type.jpg
new file mode 100644
index 00000000..0c60e952
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/fixtures/image-no-content-type.jpg
Binary files differ
diff --git a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
index 7be1eb18..f507563c 100644
--- a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
+++ b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
@@ -10,7 +10,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
10class ImportCommandTest extends WallabagCoreTestCase 10class ImportCommandTest extends WallabagCoreTestCase
11{ 11{
12 /** 12 /**
13 * @expectedException Symfony\Component\Console\Exception\RuntimeException 13 * @expectedException \Symfony\Component\Console\Exception\RuntimeException
14 * @expectedExceptionMessage Not enough arguments 14 * @expectedExceptionMessage Not enough arguments
15 */ 15 */
16 public function testRunImportCommandWithoutArguments() 16 public function testRunImportCommandWithoutArguments()
@@ -27,7 +27,7 @@ class ImportCommandTest extends WallabagCoreTestCase
27 } 27 }
28 28
29 /** 29 /**
30 * @expectedException Symfony\Component\Config\Definition\Exception\Exception 30 * @expectedException \Symfony\Component\Config\Definition\Exception\Exception
31 * @expectedExceptionMessage not found 31 * @expectedExceptionMessage not found
32 */ 32 */
33 public function testRunImportCommandWithoutFilepath() 33 public function testRunImportCommandWithoutFilepath()
@@ -40,16 +40,15 @@ class ImportCommandTest extends WallabagCoreTestCase
40 $tester = new CommandTester($command); 40 $tester = new CommandTester($command);
41 $tester->execute([ 41 $tester->execute([
42 'command' => $command->getName(), 42 'command' => $command->getName(),
43 'userId' => 1, 43 'username' => 'admin',
44 'filepath' => 1, 44 'filepath' => 1,
45 ]); 45 ]);
46 } 46 }
47 47
48 /** 48 /**
49 * @expectedException Symfony\Component\Config\Definition\Exception\Exception 49 * @expectedException \Doctrine\ORM\NoResultException
50 * @expectedExceptionMessage User with id
51 */ 50 */
52 public function testRunImportCommandWithoutUserId() 51 public function testRunImportCommandWithWrongUsername()
53 { 52 {
54 $application = new Application($this->getClient()->getKernel()); 53 $application = new Application($this->getClient()->getKernel());
55 $application->add(new ImportCommand()); 54 $application->add(new ImportCommand());
@@ -59,7 +58,7 @@ class ImportCommandTest extends WallabagCoreTestCase
59 $tester = new CommandTester($command); 58 $tester = new CommandTester($command);
60 $tester->execute([ 59 $tester->execute([
61 'command' => $command->getName(), 60 'command' => $command->getName(),
62 'userId' => 0, 61 'username' => 'random',
63 'filepath' => './', 62 'filepath' => './',
64 ]); 63 ]);
65 } 64 }
@@ -74,7 +73,7 @@ class ImportCommandTest extends WallabagCoreTestCase
74 $tester = new CommandTester($command); 73 $tester = new CommandTester($command);
75 $tester->execute([ 74 $tester->execute([
76 'command' => $command->getName(), 75 'command' => $command->getName(),
77 'userId' => 1, 76 'username' => 'admin',
78 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', 77 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
79 '--importer' => 'v2', 78 '--importer' => 'v2',
80 ]); 79 ]);
@@ -82,4 +81,21 @@ class ImportCommandTest extends WallabagCoreTestCase
82 $this->assertContains('imported', $tester->getDisplay()); 81 $this->assertContains('imported', $tester->getDisplay());
83 $this->assertContains('already saved', $tester->getDisplay()); 82 $this->assertContains('already saved', $tester->getDisplay());
84 } 83 }
84
85 public function testRunImportCommandWithUserId()
86 {
87 $application = new Application($this->getClient()->getKernel());
88 $application->add(new ImportCommand());
89
90 $command = $application->find('wallabag:import');
91
92 $tester = new CommandTester($command);
93 $tester->execute([
94 'command' => $command->getName(),
95 'username' => 1,
96 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
97 '--useUserId' => true,
98 '--importer' => 'v2',
99 ]);
100 }
85} 101}
diff --git a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php
index 74952847..e5e251a0 100644
--- a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php
+++ b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php
@@ -11,7 +11,7 @@ use M6Web\Component\RedisMock\RedisMockFactory;
11class RedisWorkerCommandTest extends WallabagCoreTestCase 11class RedisWorkerCommandTest extends WallabagCoreTestCase
12{ 12{
13 /** 13 /**
14 * @expectedException Symfony\Component\Console\Exception\RuntimeException 14 * @expectedException \Symfony\Component\Console\Exception\RuntimeException
15 * @expectedExceptionMessage Not enough arguments (missing: "serviceName") 15 * @expectedExceptionMessage Not enough arguments (missing: "serviceName")
16 */ 16 */
17 public function testRunRedisWorkerCommandWithoutArguments() 17 public function testRunRedisWorkerCommandWithoutArguments()
@@ -28,7 +28,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
28 } 28 }
29 29
30 /** 30 /**
31 * @expectedException Symfony\Component\Config\Definition\Exception\Exception 31 * @expectedException \Symfony\Component\Config\Definition\Exception\Exception
32 * @expectedExceptionMessage No queue or consumer found for service name 32 * @expectedExceptionMessage No queue or consumer found for service name
33 */ 33 */
34 public function testRunRedisWorkerCommandWithBadService() 34 public function testRunRedisWorkerCommandWithBadService()
diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
index c1f82ea9..8e9f65e3 100644
--- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
@@ -120,7 +120,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
120 120
121 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok'); 121 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok');
122 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok'); 122 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok');
123 $this->assertEquals(0, count($content->getTags())); 123 $this->assertEquals(1, count($content->getTags()));
124 124
125 $createdAt = $content->getCreatedAt(); 125 $createdAt = $content->getCreatedAt();
126 $this->assertEquals('2011', $createdAt->format('Y')); 126 $this->assertEquals('2011', $createdAt->format('Y'));
diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
index 7557ea32..5354439c 100644
--- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
@@ -121,19 +121,19 @@ class FirefoxControllerTest extends WallabagCoreTestCase
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok');
124 $this->assertEquals(2, count($content->getTags())); 124 $this->assertEquals(3, count($content->getTags()));
125 125
126 $content = $client->getContainer() 126 $content = $client->getContainer()
127 ->get('doctrine.orm.entity_manager') 127 ->get('doctrine.orm.entity_manager')
128 ->getRepository('WallabagCoreBundle:Entry') 128 ->getRepository('WallabagCoreBundle:Entry')
129 ->findByUrlAndUserId( 129 ->findByUrlAndUserId(
130 'http://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java', 130 'https://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java',
131 $this->getLoggedInUserId() 131 $this->getLoggedInUserId()
132 ); 132 );
133 133
134 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://stackoverflow.com is ok'); 134 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://stackoverflow.com is ok');
135 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://stackoverflow.com is ok'); 135 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://stackoverflow.com is ok');
136 $this->assertEmpty($content->getLanguage(), 'Language for http://stackoverflow.com is ok'); 136 $this->assertEmpty($content->getLanguage(), 'Language for https://stackoverflow.com is ok');
137 137
138 $createdAt = $content->getCreatedAt(); 138 $createdAt = $content->getCreatedAt();
139 $this->assertEquals('2013', $createdAt->format('Y')); 139 $this->assertEquals('2013', $createdAt->format('Y'));
diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
index 3f6f2b9f..84742e0a 100644
--- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
@@ -107,6 +107,9 @@ class InstapaperControllerTest extends WallabagCoreTestCase
107 107
108 $crawler = $client->followRedirect(); 108 $crawler = $client->followRedirect();
109 109
110 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
111 $this->assertContains('flashes.import.notice.summary', $body[0]);
112
110 $content = $client->getContainer() 113 $content = $client->getContainer()
111 ->get('doctrine.orm.entity_manager') 114 ->get('doctrine.orm.entity_manager')
112 ->getRepository('WallabagCoreBundle:Entry') 115 ->getRepository('WallabagCoreBundle:Entry')
@@ -115,14 +118,25 @@ class InstapaperControllerTest extends WallabagCoreTestCase
115 $this->getLoggedInUserId() 118 $this->getLoggedInUserId()
116 ); 119 );
117 120
118 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
119 $this->assertContains('flashes.import.notice.summary', $body[0]);
120
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok');
124 $this->assertEquals(0, count($content->getTags())); 124 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag');
125 $this->assertEquals(1, count($content->getTags()));
125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 126 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
127
128 $content = $client->getContainer()
129 ->get('doctrine.orm.entity_manager')
130 ->getRepository('WallabagCoreBundle:Entry')
131 ->findByUrlAndUserId(
132 'http://www.20minutes.fr/high-tech/2077615-20170531-dis-donc-donald-trump-quoi-exactement-covfefe',
133 $this->getLoggedInUserId()
134 );
135
136 $this->assertContains('foot', $content->getTags());
137 $this->assertContains('test_tag', $content->getTags());
138
139 $this->assertEquals(2, count($content->getTags()));
126 } 140 }
127 141
128 public function testImportInstapaperWithFileAndMarkAllAsRead() 142 public function testImportInstapaperWithFileAndMarkAllAsRead()
diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
index 75a7e332..e2b6e7b6 100644
--- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
@@ -121,7 +121,13 @@ class PinboardControllerTest extends WallabagCoreTestCase
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok');
124 $this->assertEquals(2, count($content->getTags())); 124
125 $tags = $content->getTags();
126 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
127 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag');
128 $this->assertContains('PHP', $tags, 'It includes the "PHP" tag');
129 $this->assertEquals(3, count($tags));
130
125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
126 $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); 132 $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d'));
127 } 133 }
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
index acb61ca1..bde0a600 100644
--- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
@@ -121,7 +121,11 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.zataz.com is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.zataz.com is ok');
124 $this->assertEquals(0, count($content->getTags())); 124
125 $tags = $content->getTags();
126 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
127 $this->assertEquals(1, count($tags));
128
125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 129 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
126 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 130 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
127 } 131 }
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index acc39997..2c492c20 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -112,24 +112,22 @@ 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 $tag = $client->getContainer()
120 ->get('doctrine.orm.entity_manager')
121 ->getRepository('WallabagCoreBundle:Tag')
122 ->findOneByLabel('Framabag');
123
124 $this->assertTrue($content->getTags()->contains($tag));
125
126 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); 119 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
127 $this->assertContains('flashes.import.notice.summary', $body[0]); 120 $this->assertContains('flashes.import.notice.summary', $body[0]);
128 121
129 $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');
130 $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');
131 $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');
132 $this->assertEquals(1, count($content->getTags())); 125
126 $tags = $content->getTags();
127 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
128 $this->assertContains('Framabag', $tags, 'It includes the "Framabag" tag');
129 $this->assertEquals(2, count($tags));
130
133 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 131 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
134 } 132 }
135 133
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
index 26e2f40b..24893259 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -119,10 +119,14 @@ 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 // empty because it wasn't re-imported
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 123 $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is empty');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 124 $this->assertEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is empty');
125 $this->assertEquals(0, count($content->getTags())); 125 $this->assertEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is empty');
126
127 $tags = $content->getTags();
128 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
129 $this->assertEquals(1, count($tags));
126 130
127 $content = $client->getContainer() 131 $content = $client->getContainer()
128 ->get('doctrine.orm.entity_manager') 132 ->get('doctrine.orm.entity_manager')
@@ -135,9 +139,16 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
135 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.mediapart.fr is ok'); 139 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.mediapart.fr is ok');
136 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.mediapart.fr is ok'); 140 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.mediapart.fr is ok');
137 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok'); 141 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok');
138 $this->assertEquals(2, count($content->getTags())); 142
143 $tags = $content->getTags();
144 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
145 $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag');
146 $this->assertContains('blog', $tags, 'It includes the "blog" tag');
147 $this->assertEquals(3, count($tags));
148
139 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 149 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
140 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 150 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
151 $this->assertTrue($content->isStarred(), 'Entry is starred');
141 } 152 }
142 153
143 public function testImportWallabagWithEmptyFile() 154 public function testImportWallabagWithEmptyFile()
diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
index 6b3adda4..cec19534 100644
--- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
@@ -17,6 +17,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
20 21
21 private function getChromeImport($unsetUser = false, $dispatched = 0) 22 private function getChromeImport($unsetUser = false, $dispatched = 0)
22 { 23 {
@@ -30,6 +31,10 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
30 ->disableOriginalConstructor() 31 ->disableOriginalConstructor()
31 ->getMock(); 32 ->getMock();
32 33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
33 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
34 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
35 ->getMock(); 40 ->getMock();
@@ -38,7 +43,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
38 ->expects($this->exactly($dispatched)) 43 ->expects($this->exactly($dispatched))
39 ->method('dispatch'); 44 ->method('dispatch');
40 45
41 $wallabag = new ChromeImport($this->em, $this->contentProxy, $dispatcher); 46 $wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
42 47
43 $this->logHandler = new TestHandler(); 48 $this->logHandler = new TestHandler();
44 $logger = new Logger('test', [$this->logHandler]); 49 $logger = new Logger('test', [$this->logHandler]);
diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
index b516fbc5..c186c820 100644
--- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
@@ -17,6 +17,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
20 21
21 private function getFirefoxImport($unsetUser = false, $dispatched = 0) 22 private function getFirefoxImport($unsetUser = false, $dispatched = 0)
22 { 23 {
@@ -30,6 +31,10 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
30 ->disableOriginalConstructor() 31 ->disableOriginalConstructor()
31 ->getMock(); 32 ->getMock();
32 33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
33 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
34 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
35 ->getMock(); 40 ->getMock();
@@ -38,7 +43,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
38 ->expects($this->exactly($dispatched)) 43 ->expects($this->exactly($dispatched))
39 ->method('dispatch'); 44 ->method('dispatch');
40 45
41 $wallabag = new FirefoxImport($this->em, $this->contentProxy, $dispatcher); 46 $wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
42 47
43 $this->logHandler = new TestHandler(); 48 $this->logHandler = new TestHandler();
44 $logger = new Logger('test', [$this->logHandler]); 49 $logger = new Logger('test', [$this->logHandler]);
diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
index e262a808..9158c8a2 100644
--- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
@@ -17,6 +17,8 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
21 protected $uow;
20 22
21 private function getInstapaperImport($unsetUser = false, $dispatched = 0) 23 private function getInstapaperImport($unsetUser = false, $dispatched = 0)
22 { 24 {
@@ -26,10 +28,28 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
26 ->disableOriginalConstructor() 28 ->disableOriginalConstructor()
27 ->getMock(); 29 ->getMock();
28 30
31 $this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
32 ->disableOriginalConstructor()
33 ->getMock();
34
35 $this->em
36 ->expects($this->any())
37 ->method('getUnitOfWork')
38 ->willReturn($this->uow);
39
40 $this->uow
41 ->expects($this->any())
42 ->method('getScheduledEntityInsertions')
43 ->willReturn([]);
44
29 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') 45 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
30 ->disableOriginalConstructor() 46 ->disableOriginalConstructor()
31 ->getMock(); 47 ->getMock();
32 48
49 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
50 ->disableOriginalConstructor()
51 ->getMock();
52
33 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 53 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
34 ->disableOriginalConstructor() 54 ->disableOriginalConstructor()
35 ->getMock(); 55 ->getMock();
@@ -38,7 +58,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
38 ->expects($this->exactly($dispatched)) 58 ->expects($this->exactly($dispatched))
39 ->method('dispatch'); 59 ->method('dispatch');
40 60
41 $import = new InstapaperImport($this->em, $this->contentProxy, $dispatcher); 61 $import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
42 62
43 $this->logHandler = new TestHandler(); 63 $this->logHandler = new TestHandler();
44 $logger = new Logger('test', [$this->logHandler]); 64 $logger = new Logger('test', [$this->logHandler]);
@@ -62,14 +82,14 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
62 82
63 public function testImport() 83 public function testImport()
64 { 84 {
65 $instapaperImport = $this->getInstapaperImport(false, 3); 85 $instapaperImport = $this->getInstapaperImport(false, 4);
66 $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); 86 $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv');
67 87
68 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 88 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
69 ->disableOriginalConstructor() 89 ->disableOriginalConstructor()
70 ->getMock(); 90 ->getMock();
71 91
72 $entryRepo->expects($this->exactly(3)) 92 $entryRepo->expects($this->exactly(4))
73 ->method('findByUrlAndUserId') 93 ->method('findByUrlAndUserId')
74 ->willReturn(false); 94 ->willReturn(false);
75 95
@@ -83,14 +103,14 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
83 ->getMock(); 103 ->getMock();
84 104
85 $this->contentProxy 105 $this->contentProxy
86 ->expects($this->exactly(3)) 106 ->expects($this->exactly(4))
87 ->method('updateEntry') 107 ->method('updateEntry')
88 ->willReturn($entry); 108 ->willReturn($entry);
89 109
90 $res = $instapaperImport->import(); 110 $res = $instapaperImport->import();
91 111
92 $this->assertTrue($res); 112 $this->assertTrue($res);
93 $this->assertEquals(['skipped' => 0, 'imported' => 3, 'queued' => 0], $instapaperImport->getSummary()); 113 $this->assertEquals(['skipped' => 0, 'imported' => 4, 'queued' => 0], $instapaperImport->getSummary());
94 } 114 }
95 115
96 public function testImportAndMarkAllAsRead() 116 public function testImportAndMarkAllAsRead()
@@ -102,9 +122,9 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
102 ->disableOriginalConstructor() 122 ->disableOriginalConstructor()
103 ->getMock(); 123 ->getMock();
104 124
105 $entryRepo->expects($this->exactly(3)) 125 $entryRepo->expects($this->exactly(4))
106 ->method('findByUrlAndUserId') 126 ->method('findByUrlAndUserId')
107 ->will($this->onConsecutiveCalls(false, true, true)); 127 ->will($this->onConsecutiveCalls(false, true, true, true));
108 128
109 $this->em 129 $this->em
110 ->expects($this->any()) 130 ->expects($this->any())
@@ -128,7 +148,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
128 148
129 $this->assertTrue($res); 149 $this->assertTrue($res);
130 150
131 $this->assertEquals(['skipped' => 2, 'imported' => 1, 'queued' => 0], $instapaperImport->getSummary()); 151 $this->assertEquals(['skipped' => 3, 'imported' => 1, 'queued' => 0], $instapaperImport->getSummary());
132 } 152 }
133 153
134 public function testImportWithRabbit() 154 public function testImportWithRabbit()
@@ -160,7 +180,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
160 ->getMock(); 180 ->getMock();
161 181
162 $producer 182 $producer
163 ->expects($this->exactly(3)) 183 ->expects($this->exactly(4))
164 ->method('publish'); 184 ->method('publish');
165 185
166 $instapaperImport->setProducer($producer); 186 $instapaperImport->setProducer($producer);
@@ -168,7 +188,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
168 $res = $instapaperImport->setMarkAsRead(true)->import(); 188 $res = $instapaperImport->setMarkAsRead(true)->import();
169 189
170 $this->assertTrue($res); 190 $this->assertTrue($res);
171 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 3], $instapaperImport->getSummary()); 191 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary());
172 } 192 }
173 193
174 public function testImportWithRedis() 194 public function testImportWithRedis()
@@ -206,7 +226,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
206 $res = $instapaperImport->setMarkAsRead(true)->import(); 226 $res = $instapaperImport->setMarkAsRead(true)->import();
207 227
208 $this->assertTrue($res); 228 $this->assertTrue($res);
209 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 3], $instapaperImport->getSummary()); 229 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $instapaperImport->getSummary());
210 230
211 $this->assertNotEmpty($redisMock->lpop('instapaper')); 231 $this->assertNotEmpty($redisMock->lpop('instapaper'));
212 } 232 }
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index 141ece36..b81ebe15 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -23,6 +23,8 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
23 protected $em; 23 protected $em;
24 protected $contentProxy; 24 protected $contentProxy;
25 protected $logHandler; 25 protected $logHandler;
26 protected $tagsAssigner;
27 protected $uow;
26 28
27 private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0) 29 private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0)
28 { 30 {
@@ -37,6 +39,10 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
37 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
38 ->getMock(); 40 ->getMock();
39 41
42 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
43 ->disableOriginalConstructor()
44 ->getMock();
45
40 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') 46 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
41 ->disableOriginalConstructor() 47 ->disableOriginalConstructor()
42 ->getMock(); 48 ->getMock();
@@ -63,7 +69,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
63 ->expects($this->exactly($dispatched)) 69 ->expects($this->exactly($dispatched))
64 ->method('dispatch'); 70 ->method('dispatch');
65 71
66 $pocket = new PocketImport($this->em, $this->contentProxy, $dispatcher); 72 $pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
67 $pocket->setUser($this->user); 73 $pocket->setUser($this->user);
68 74
69 $this->logHandler = new TestHandler(); 75 $this->logHandler = new TestHandler();
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
index d1bbe648..8f466d38 100644
--- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
@@ -17,6 +17,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
20 21
21 private function getReadabilityImport($unsetUser = false, $dispatched = 0) 22 private function getReadabilityImport($unsetUser = false, $dispatched = 0)
22 { 23 {
@@ -30,6 +31,10 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
30 ->disableOriginalConstructor() 31 ->disableOriginalConstructor()
31 ->getMock(); 32 ->getMock();
32 33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
33 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
34 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
35 ->getMock(); 40 ->getMock();
@@ -38,7 +43,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
38 ->expects($this->exactly($dispatched)) 43 ->expects($this->exactly($dispatched))
39 ->method('dispatch'); 44 ->method('dispatch');
40 45
41 $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $dispatcher); 46 $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
42 47
43 $this->logHandler = new TestHandler(); 48 $this->logHandler = new TestHandler();
44 $logger = new Logger('test', [$this->logHandler]); 49 $logger = new Logger('test', [$this->logHandler]);
@@ -62,14 +67,14 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
62 67
63 public function testImport() 68 public function testImport()
64 { 69 {
65 $readabilityImport = $this->getReadabilityImport(false, 24); 70 $readabilityImport = $this->getReadabilityImport(false, 3);
66 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); 71 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json');
67 72
68 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 73 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
69 ->disableOriginalConstructor() 74 ->disableOriginalConstructor()
70 ->getMock(); 75 ->getMock();
71 76
72 $entryRepo->expects($this->exactly(24)) 77 $entryRepo->expects($this->exactly(3))
73 ->method('findByUrlAndUserId') 78 ->method('findByUrlAndUserId')
74 ->willReturn(false); 79 ->willReturn(false);
75 80
@@ -83,14 +88,14 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
83 ->getMock(); 88 ->getMock();
84 89
85 $this->contentProxy 90 $this->contentProxy
86 ->expects($this->exactly(24)) 91 ->expects($this->exactly(3))
87 ->method('updateEntry') 92 ->method('updateEntry')
88 ->willReturn($entry); 93 ->willReturn($entry);
89 94
90 $res = $readabilityImport->import(); 95 $res = $readabilityImport->import();
91 96
92 $this->assertTrue($res); 97 $this->assertTrue($res);
93 $this->assertEquals(['skipped' => 0, 'imported' => 24, 'queued' => 0], $readabilityImport->getSummary()); 98 $this->assertEquals(['skipped' => 0, 'imported' => 3, 'queued' => 0], $readabilityImport->getSummary());
94 } 99 }
95 100
96 public function testImportAndMarkAllAsRead() 101 public function testImportAndMarkAllAsRead()
@@ -160,7 +165,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
160 ->getMock(); 165 ->getMock();
161 166
162 $producer 167 $producer
163 ->expects($this->exactly(24)) 168 ->expects($this->exactly(3))
164 ->method('publish'); 169 ->method('publish');
165 170
166 $readabilityImport->setProducer($producer); 171 $readabilityImport->setProducer($producer);
@@ -168,7 +173,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
168 $res = $readabilityImport->setMarkAsRead(true)->import(); 173 $res = $readabilityImport->setMarkAsRead(true)->import();
169 174
170 $this->assertTrue($res); 175 $this->assertTrue($res);
171 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $readabilityImport->getSummary()); 176 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary());
172 } 177 }
173 178
174 public function testImportWithRedis() 179 public function testImportWithRedis()
@@ -206,7 +211,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
206 $res = $readabilityImport->setMarkAsRead(true)->import(); 211 $res = $readabilityImport->setMarkAsRead(true)->import();
207 212
208 $this->assertTrue($res); 213 $this->assertTrue($res);
209 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $readabilityImport->getSummary()); 214 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 3], $readabilityImport->getSummary());
210 215
211 $this->assertNotEmpty($redisMock->lpop('readability')); 216 $this->assertNotEmpty($redisMock->lpop('readability'));
212 } 217 }
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
index 4dbced60..834b7ef5 100644
--- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
@@ -17,6 +17,10 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
21 protected $uow;
22 protected $fetchingErrorMessageTitle = 'No title found';
23 protected $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.';
20 24
21 private function getWallabagV1Import($unsetUser = false, $dispatched = 0) 25 private function getWallabagV1Import($unsetUser = false, $dispatched = 0)
22 { 26 {
@@ -44,6 +48,10 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
44 ->disableOriginalConstructor() 48 ->disableOriginalConstructor()
45 ->getMock(); 49 ->getMock();
46 50
51 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
52 ->disableOriginalConstructor()
53 ->getMock();
54
47 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 55 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
48 ->disableOriginalConstructor() 56 ->disableOriginalConstructor()
49 ->getMock(); 57 ->getMock();
@@ -52,7 +60,14 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
52 ->expects($this->exactly($dispatched)) 60 ->expects($this->exactly($dispatched))
53 ->method('dispatch'); 61 ->method('dispatch');
54 62
55 $wallabag = new WallabagV1Import($this->em, $this->contentProxy, $dispatcher); 63 $wallabag = new WallabagV1Import(
64 $this->em,
65 $this->contentProxy,
66 $this->tagsAssigner,
67 $dispatcher,
68 $this->fetchingErrorMessageTitle,
69 $this->fetchingErrorMessage
70 );
56 71
57 $this->logHandler = new TestHandler(); 72 $this->logHandler = new TestHandler();
58 $logger = new Logger('test', [$this->logHandler]); 73 $logger = new Logger('test', [$this->logHandler]);
@@ -76,14 +91,14 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
76 91
77 public function testImport() 92 public function testImport()
78 { 93 {
79 $wallabagV1Import = $this->getWallabagV1Import(false, 3); 94 $wallabagV1Import = $this->getWallabagV1Import(false, 1);
80 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); 95 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json');
81 96
82 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 97 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
83 ->disableOriginalConstructor() 98 ->disableOriginalConstructor()
84 ->getMock(); 99 ->getMock();
85 100
86 $entryRepo->expects($this->exactly(4)) 101 $entryRepo->expects($this->exactly(2))
87 ->method('findByUrlAndUserId') 102 ->method('findByUrlAndUserId')
88 ->will($this->onConsecutiveCalls(false, true, false, false)); 103 ->will($this->onConsecutiveCalls(false, true, false, false));
89 104
@@ -97,14 +112,14 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
97 ->getMock(); 112 ->getMock();
98 113
99 $this->contentProxy 114 $this->contentProxy
100 ->expects($this->exactly(3)) 115 ->expects($this->exactly(1))
101 ->method('updateEntry') 116 ->method('updateEntry')
102 ->willReturn($entry); 117 ->willReturn($entry);
103 118
104 $res = $wallabagV1Import->import(); 119 $res = $wallabagV1Import->import();
105 120
106 $this->assertTrue($res); 121 $this->assertTrue($res);
107 $this->assertEquals(['skipped' => 1, 'imported' => 3, 'queued' => 0], $wallabagV1Import->getSummary()); 122 $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $wallabagV1Import->getSummary());
108 } 123 }
109 124
110 public function testImportAndMarkAllAsRead() 125 public function testImportAndMarkAllAsRead()
@@ -174,7 +189,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
174 ->getMock(); 189 ->getMock();
175 190
176 $producer 191 $producer
177 ->expects($this->exactly(4)) 192 ->expects($this->exactly(2))
178 ->method('publish'); 193 ->method('publish');
179 194
180 $wallabagV1Import->setProducer($producer); 195 $wallabagV1Import->setProducer($producer);
@@ -182,7 +197,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
182 $res = $wallabagV1Import->setMarkAsRead(true)->import(); 197 $res = $wallabagV1Import->setMarkAsRead(true)->import();
183 198
184 $this->assertTrue($res); 199 $this->assertTrue($res);
185 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $wallabagV1Import->getSummary()); 200 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary());
186 } 201 }
187 202
188 public function testImportWithRedis() 203 public function testImportWithRedis()
@@ -220,7 +235,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
220 $res = $wallabagV1Import->setMarkAsRead(true)->import(); 235 $res = $wallabagV1Import->setMarkAsRead(true)->import();
221 236
222 $this->assertTrue($res); 237 $this->assertTrue($res);
223 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $wallabagV1Import->getSummary()); 238 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary());
224 239
225 $this->assertNotEmpty($redisMock->lpop('wallabag_v1')); 240 $this->assertNotEmpty($redisMock->lpop('wallabag_v1'));
226 } 241 }
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
index 0e50b8b2..5cc04aa5 100644
--- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
@@ -17,6 +17,8 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
21 protected $uow;
20 22
21 private function getWallabagV2Import($unsetUser = false, $dispatched = 0) 23 private function getWallabagV2Import($unsetUser = false, $dispatched = 0)
22 { 24 {
@@ -44,6 +46,10 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
44 ->disableOriginalConstructor() 46 ->disableOriginalConstructor()
45 ->getMock(); 47 ->getMock();
46 48
49 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
50 ->disableOriginalConstructor()
51 ->getMock();
52
47 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 53 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
48 ->disableOriginalConstructor() 54 ->disableOriginalConstructor()
49 ->getMock(); 55 ->getMock();
@@ -52,7 +58,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
52 ->expects($this->exactly($dispatched)) 58 ->expects($this->exactly($dispatched))
53 ->method('dispatch'); 59 ->method('dispatch');
54 60
55 $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $dispatcher); 61 $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
56 62
57 $this->logHandler = new TestHandler(); 63 $this->logHandler = new TestHandler();
58 $logger = new Logger('test', [$this->logHandler]); 64 $logger = new Logger('test', [$this->logHandler]);
@@ -83,7 +89,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
83 ->disableOriginalConstructor() 89 ->disableOriginalConstructor()
84 ->getMock(); 90 ->getMock();
85 91
86 $entryRepo->expects($this->exactly(24)) 92 $entryRepo->expects($this->exactly(6))
87 ->method('findByUrlAndUserId') 93 ->method('findByUrlAndUserId')
88 ->will($this->onConsecutiveCalls(false, true, false)); 94 ->will($this->onConsecutiveCalls(false, true, false));
89 95
@@ -100,7 +106,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
100 $res = $wallabagV2Import->import(); 106 $res = $wallabagV2Import->import();
101 107
102 $this->assertTrue($res); 108 $this->assertTrue($res);
103 $this->assertEquals(['skipped' => 22, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); 109 $this->assertEquals(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
104 } 110 }
105 111
106 public function testImportAndMarkAllAsRead() 112 public function testImportAndMarkAllAsRead()
@@ -166,7 +172,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
166 ->getMock(); 172 ->getMock();
167 173
168 $producer 174 $producer
169 ->expects($this->exactly(24)) 175 ->expects($this->exactly(6))
170 ->method('publish'); 176 ->method('publish');
171 177
172 $wallabagV2Import->setProducer($producer); 178 $wallabagV2Import->setProducer($producer);
@@ -174,7 +180,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
174 $res = $wallabagV2Import->setMarkAsRead(true)->import(); 180 $res = $wallabagV2Import->setMarkAsRead(true)->import();
175 181
176 $this->assertTrue($res); 182 $this->assertTrue($res);
177 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $wallabagV2Import->getSummary()); 183 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary());
178 } 184 }
179 185
180 public function testImportWithRedis() 186 public function testImportWithRedis()
@@ -208,7 +214,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
208 $res = $wallabagV2Import->setMarkAsRead(true)->import(); 214 $res = $wallabagV2Import->setMarkAsRead(true)->import();
209 215
210 $this->assertTrue($res); 216 $this->assertTrue($res);
211 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $wallabagV2Import->getSummary()); 217 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary());
212 218
213 $this->assertNotEmpty($redisMock->lpop('wallabag_v2')); 219 $this->assertNotEmpty($redisMock->lpop('wallabag_v2'));
214 } 220 }
@@ -261,7 +267,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
261 ->disableOriginalConstructor() 267 ->disableOriginalConstructor()
262 ->getMock(); 268 ->getMock();
263 269
264 $entryRepo->expects($this->exactly(24)) 270 $entryRepo->expects($this->exactly(6))
265 ->method('findByUrlAndUserId') 271 ->method('findByUrlAndUserId')
266 ->will($this->onConsecutiveCalls(false, true, false)); 272 ->will($this->onConsecutiveCalls(false, true, false));
267 273
@@ -278,6 +284,6 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
278 $res = $wallabagV2Import->import(); 284 $res = $wallabagV2Import->import();
279 285
280 $this->assertTrue($res); 286 $this->assertTrue($res);
281 $this->assertEquals(['skipped' => 22, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary()); 287 $this->assertEquals(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
282 } 288 }
283} 289}
diff --git a/tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv b/tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv
index 28a4c8e6..1a648f8a 100644
--- a/tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv
+++ b/tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv
@@ -2,3 +2,4 @@ URL,Title,Selection,Folder
2http://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551,Baumettes : un tour en cellule,,Unread 2http://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551,Baumettes : un tour en cellule,,Unread
3https://redditblog.com/2016/09/20/amp-and-reactredux/,AMP and React+Redux: Why Not?,,Archive 3https://redditblog.com/2016/09/20/amp-and-reactredux/,AMP and React+Redux: Why Not?,,Archive
4https://medium.com/@the_minh/why-foursquare-swarm-is-still-my-favourite-social-network-e38228493e6c,Why Foursquare / Swarm is still my favourite social network,,Starred 4https://medium.com/@the_minh/why-foursquare-swarm-is-still-my-favourite-social-network-e38228493e6c,Why Foursquare / Swarm is still my favourite social network,,Starred
5http://www.20minutes.fr/high-tech/2077615-20170531-dis-donc-donald-trump-quoi-exactement-covfefe,"Dis donc Donald Trump, c'est quoi exactement «covfefe»?",,test_tag
diff --git a/tests/Wallabag/ImportBundle/fixtures/pinboard_export b/tests/Wallabag/ImportBundle/fixtures/pinboard_export
index 2dd744d3..b5f653e7 100644
--- a/tests/Wallabag/ImportBundle/fixtures/pinboard_export
+++ b/tests/Wallabag/ImportBundle/fixtures/pinboard_export
@@ -1,5 +1,3 @@
1[{"href":"https:\/\/developers.google.com\/web\/updates\/2016\/07\/infinite-scroller","description":"Complexities of an Infinite Scroller","extended":"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","meta":"21ff61c6f648901168f9e6119f53df7d","hash":"e69b65724cca1c585b446d4c47865d76","time":"2016-10-31T15:57:56Z","shared":"yes","toread":"no","tags":"infinite dom performance scroll"}, 1[{"href":"https:\/\/developers.google.com\/web\/updates\/2016\/07\/infinite-scroller","description":"Complexities of an Infinite Scroller","extended":"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","meta":"21ff61c6f648901168f9e6119f53df7d","hash":"e69b65724cca1c585b446d4c47865d76","time":"2016-10-31T15:57:56Z","shared":"yes","toread":"no","tags":"infinite dom performance scroll"},
2{"href":"https:\/\/ma.ttias.be\/varnish-explained\/","description":"Varnish (explained) for PHP developers","extended":"A few months ago, I gave a presentation at LaraconEU in Amsterdam titled \"Varnish for PHP developers\". The generic title of that presentation is actually Varnish Explained and this is a write-up of that presentation, the video and the slides.","meta":"d32ad9fac2ed29da4aec12c562e9afb1","hash":"21dd6bdda8ad62666a2c9e79f6e80f98","time":"2016-10-26T06:43:03Z","shared":"yes","toread":"no","tags":"varnish PHP"}, 2{"href":"https:\/\/ma.ttias.be\/varnish-explained\/","description":"Varnish (explained) for PHP developers","extended":"A few months ago, I gave a presentation at LaraconEU in Amsterdam titled \"Varnish for PHP developers\". The generic title of that presentation is actually Varnish Explained and this is a write-up of that presentation, the video and the slides.","meta":"d32ad9fac2ed29da4aec12c562e9afb1","hash":"21dd6bdda8ad62666a2c9e79f6e80f98","time":"2016-10-26T06:43:03Z","shared":"yes","toread":"no","tags":"varnish PHP"},
3{"href":"https:\/\/ilia.ws\/files\/nginx_torontophpug.pdf","description":"Nginx Tricks for PHP Developers","extended":"","meta":"9adbb5c4ca6760e335b920800d88c70a","hash":"0189bb08f8bd0122c6544bed4624c546","time":"2016-10-05T07:11:27Z","shared":"yes","toread":"no","tags":"nginx PHP best_practice"}, 3{"href":"https:\/\/ilia.ws\/files\/nginx_torontophpug.pdf","description":"Nginx Tricks for PHP Developers","extended":"","meta":"9adbb5c4ca6760e335b920800d88c70a","hash":"0189bb08f8bd0122c6544bed4624c546","time":"2016-10-05T07:11:27Z","shared":"yes","toread":"no","tags":"nginx PHP best_practice"}]
4{"href":"https:\/\/jolicode.com\/blog\/starting-a-mobile-application-with-react-native","description":"Starting a mobile application with React Native","extended":"While preparing our next React Native training, I learnt a lot on the library and discovered an amazing community with a lot of packages.","meta":"bd140bd3e53e3a0b4cb08cdaf64bcbfc","hash":"015fa10cd97f56186420555e52cfab62","time":"2016-09-23T10:58:20Z","shared":"yes","toread":"no","tags":"react-native"},
5{"href":"http:\/\/open.blogs.nytimes.com\/2016\/08\/29\/testing-varnish-using-varnishtest\/","description":"Testing Varnish Using Varnishtest","extended":"Varnish ships with the ability to test using the testing tool varnishtest. Varnishtest gives you the ability to write VCL tests you can run on the command line or as part of your build process.","meta":"ca2752a07adea4bab52cd19e8fdbf356","hash":"d3e642cc1274d10e4c12ee31f5dde736","time":"2016-08-30T09:33:24Z","shared":"yes","toread":"no","tags":"varnish test vcl"}]
diff --git a/tests/Wallabag/ImportBundle/fixtures/readability.json b/tests/Wallabag/ImportBundle/fixtures/readability.json
index 32f6fa53..b9fd570d 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,
@@ -28,148 +21,8 @@
28 "archive": 0, 21 "archive": 0,
29 "date_added": "2016-09-08T11:55:58+0200", 22 "date_added": "2016-09-08T11:55:58+0200",
30 "favorite": 0, 23 "favorite": 0,
31 "article__title": "Échecs",
32 "article__url": "https://fr.wikipedia.org/wiki/Échecs"
33 },
34 {
35 "archive": 0,
36 "date_added": "2016-09-08T11:55:58+0200",
37 "favorite": 0,
38 "article__title": "90% des dossiers médicaux des Coréens du sud vendus à des entreprises privées - ZATAZ", 24 "article__title": "90% des dossiers médicaux des Coréens du sud vendus à des entreprises privées - ZATAZ",
39 "article__url": "http://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/" 25 "article__url": "http://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/"
40 },
41 {
42 "archive": 0,
43 "date_added": "2016-09-08T11:55:58+0200",
44 "favorite": 0,
45 "article__title": "Mass Surveillance As Art",
46 "article__url": "https://www.nationaljournal.com/s/73311/mass-surveillance-art"
47 },
48 {
49 "archive": 0,
50 "date_added": "2016-09-08T11:55:58+0200",
51 "favorite": 0,
52 "article__title": "What David Cameron did to the pig, his party is now doing to the country",
53 "article__url": "http://www.newstatesman.com/2015/09/what-david-cameron-did-pig-his-party-now-doing-country"
54 },
55 {
56 "archive": 1,
57 "date_added": "2016-09-08T11:55:58+0200",
58 "favorite": 0,
59 "article__title": "CLICK HERE to support 2016 CES Winner, Revolutionary Auto-Tracking Robot",
60 "article__url": "https://www.indiegogo.com/projects/2016-ces-winner-revolutionary-auto-tracking-robot"
61 },
62 {
63 "archive": 0,
64 "date_added": "2016-09-08T11:55:58+0200",
65 "favorite": 1,
66 "article__title": "No title found",
67 "article__url": "http://carnetdevol.shost.ca/wordpress/aide-memoire-sur-les-commandes-associees-a-systemd/"
68 },
69 {
70 "archive": 1,
71 "date_added": "2016-09-08T11:55:58+0200",
72 "favorite": 0,
73 "article__title": "Présentation d'Arduino - Tuto Arduino - Le blog d'Eskimon",
74 "article__url": "http://eskimon.fr/73-arduino-101-presentation"
75 },
76 {
77 "archive": 1,
78 "date_added": "2016-09-08T11:55:58+0200",
79 "favorite": 0,
80 "article__title": "Lenovo ThinkPad X1 Carbon Ultrabook Review",
81 "article__url": "http://www.notebookcheck.net/Lenovo-ThinkPad-X1-Carbon-Ultrabook-Review.138033.0.html"
82 },
83 {
84 "archive": 0,
85 "date_added": "2016-09-08T11:55:58+0200",
86 "favorite": 0,
87 "article__title": "Visitons le Château de Landsberg !",
88 "article__url": "http://autour-du-mont-sainte-odile.overblog.com/2016/01/visitons-le-chateau-de-landsberg.html"
89 },
90 {
91 "archive": 1,
92 "date_added": "2016-09-08T11:55:58+0200",
93 "favorite": 0,
94 "article__title": "Contrer les stéréotypes par les livres : “C'est dès l'enfance qu'ils se construisent”",
95 "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"
96 },
97 {
98 "archive": 1,
99 "date_added": "2016-09-08T11:55:58+0200",
100 "favorite": 0,
101 "article__title": "[ROM][6.0.1][Layers][N5] TipsyOS official builds {UBER TCs}",
102 "article__url": "http://forum.xda-developers.com/google-nexus-5/development/rom-tipsyos-official-builds-uber-tcs-t3325989"
103 },
104 {
105 "archive": 0,
106 "date_added": "2016-09-08T11:55:58+0200",
107 "favorite": 0,
108 "article__title": "Top 15 Podcasts All Web Developers Should Follow - Envato Tuts+ Code Article",
109 "article__url": "http://code.tutsplus.com/articles/top-15-podcasts-all-web-developers-should-follow--net-14461"
110 },
111 {
112 "archive": 1,
113 "date_added": "2016-09-08T11:55:58+0200",
114 "favorite": 0,
115 "article__title": "University of Mississippi",
116 "article__url": "http://olemiss.edu"
117 },
118 {
119 "archive": 1,
120 "date_added": "2016-09-08T11:55:58+0200",
121 "favorite": 0,
122 "article__title": "FinnChristiansen.de Jetzt Dank Let’s Encrypt Per HTTPS Erreichbar",
123 "article__url": "https://www.finnchristiansen.de/2015/12/06/finnchristiansen-de-jetzt-dank-lets-encrypt-per-https-erreichbar/"
124 },
125 {
126 "archive": 1,
127 "date_added": "2016-09-08T11:55:58+0200",
128 "favorite": 0,
129 "article__title": "Le développeur et l'ingénierie logicielle",
130 "article__url": "http://wemucs.com/le-developpeur-et-lingenierie-logicielle/"
131 },
132 {
133 "archive": 1,
134 "date_added": "2016-09-08T11:55:58+0200",
135 "favorite": 0,
136 "article__title": "The Role of Methylation in Gene Expression",
137 "article__url": "http://www.nature.com/scitable/topicpage/the-role-of-methylation-in-gene-expression-1070"
138 },
139 {
140 "archive": 1,
141 "date_added": "2016-09-08T11:55:58+0200",
142 "favorite": 0,
143 "article__title": "E-Mail-Adresse kostenlos, FreeMail, De-Mail & Nachrichten",
144 "article__url": "http://web.de"
145 },
146 {
147 "archive": 1,
148 "date_added": "2016-09-08T11:55:58+0200",
149 "favorite": 0,
150 "article__title": "OpenSSH Server on Arch Linux | DominicM test",
151 "article__url": "http://dominicm.com/openssh-server-arch-linux/"
152 },
153 {
154 "archive": 1,
155 "date_added": "2016-09-08T11:55:58+0200",
156 "favorite": 0,
157 "article__title": "Site Moved | Site Help",
158 "article__url": "http://g1.com/help/sitemoved.asp"
159 },
160 {
161 "archive": 1,
162 "date_added": "2016-09-08T11:55:58+0200",
163 "favorite": 0,
164 "article__title": "#Maroc : le stylo anti-pédophiles EAGLE d’AMESYS est moins bien configuré que les faux-lowers Twitter du roi Mohammed VI",
165 "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/"
166 },
167 {
168 "archive": 1,
169 "date_added": "2016-09-08T11:55:58+0200",
170 "favorite": 0,
171 "article__title": "Simple Cloud Infrastructure for Developers",
172 "article__url": "https://www.digitalocean.com/"
173 } 26 }
174 ], 27 ],
175 "recommendations": [] 28 "recommendations": []
diff --git a/tests/Wallabag/ImportBundle/fixtures/wallabag-v1.json b/tests/Wallabag/ImportBundle/fixtures/wallabag-v1.json
index f298469f..28270ec4 100644
--- a/tests/Wallabag/ImportBundle/fixtures/wallabag-v1.json
+++ b/tests/Wallabag/ImportBundle/fixtures/wallabag-v1.json
@@ -32,38 +32,5 @@
32 "content": "<span class=\"name\">README.md</span><p>wallabag is a self hostable application allowing you to not miss any content anymore. Click, save, read it when you can. It extracts content so that you can read it when you have time.</p>\n<p>More informations on our website: <a href=\"http://wallabag.org\">wallabag.org</a></p>\n<h2><a class=\"anchor\" href=\"https://github.com/wallabag/wallabag#license\"></a>License</h2>\n<p>Copyright © 2010-2014 Nicolas Lœuillet <a href=\"mailto:nicolas@loeuillet.org\">nicolas@loeuillet.org</a> This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.</p>\n", 32 "content": "<span class=\"name\">README.md</span><p>wallabag is a self hostable application allowing you to not miss any content anymore. Click, save, read it when you can. It extracts content so that you can read it when you have time.</p>\n<p>More informations on our website: <a href=\"http://wallabag.org\">wallabag.org</a></p>\n<h2><a class=\"anchor\" href=\"https://github.com/wallabag/wallabag#license\"></a>License</h2>\n<p>Copyright © 2010-2014 Nicolas Lœuillet <a href=\"mailto:nicolas@loeuillet.org\">nicolas@loeuillet.org</a> This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.</p>\n",
33 "user_id": "1", 33 "user_id": "1",
34 "tags":"" 34 "tags":""
35 },
36 {
37 "0": "3",
38 "1": "a self hostable application for saving web pages | wallabag",
39 "2": "https://www.wallabag.org/",
40 "3": "1",
41 "4": "0",
42 "5": "\n<div class=\"row\">\n<div class=\"col-lg-8 col-md-12 col-xs-12 col-sm-12\">\n<p>wallabag (formerly poche) is a <strong>self hostable application for saving web pages</strong>. Unlike other services, wallabag is free (as in freedom) and open source.</p>\n</div>\n\n</div>\n<div class=\"row\">\n<div class=\"col-lg-8 col-md-12 col-xs-12 col-sm-12\">\n<p>With this application you will not miss content anymore. <strong>Click, save, read it when you want</strong>. It saves the content you select so that you can read it when you have time.</p>\n</div>\n\n</div>\n<div class=\"row\">\n<div class=\"col-lg-6 col-md-12 col-xs-12 col-sm-12\">\n<h2>How it works</h2>\n<p>Thanks to the bookmarklet or <a title=\"Downloads\" href=\"http://www.wallabag.org/downloads/\">third-party applications</a>, you save an article in your wallabag to read it later. Then, when you open your wallabag, <strong>you can comfortably read your articles</strong>.</p>\n<h2>How to use wallabag</h2>\n<p>There are two ways to use wallabag: you can <a href=\"http://www.wallabag.org/frequently-asked-questions/#How_can_I_install_wallabag_and_what_are_the_requirements\">install it</a> on your web server or you can <a href=\"http://app.inthepoche.com\">create an account</a> at Framabag (we install and upgrade wallabag for you).</p>\n</div>\n\n</div>\n",
43 "6": "1",
44 "id": "3",
45 "title": "a self hostable application for saving web pages | wallabag",
46 "url": "https://www.wallabag.org/",
47 "is_read": "1",
48 "is_fav": "0",
49 "content": "\n<div class=\"row\">\n<div class=\"col-lg-8 col-md-12 col-xs-12 col-sm-12\">\n<p>wallabag (formerly poche) is a <strong>self hostable application for saving web pages</strong>. Unlike other services, wallabag is free (as in freedom) and open source.</p>\n</div>\n\n</div>\n<div class=\"row\">\n<div class=\"col-lg-8 col-md-12 col-xs-12 col-sm-12\">\n<p>With this application you will not miss content anymore. <strong>Click, save, read it when you want</strong>. It saves the content you select so that you can read it when you have time.</p>\n</div>\n\n</div>\n<div class=\"row\">\n<div class=\"col-lg-6 col-md-12 col-xs-12 col-sm-12\">\n<h2>How it works</h2>\n<p>Thanks to the bookmarklet or <a title=\"Downloads\" href=\"http://www.wallabag.org/downloads/\">third-party applications</a>, you save an article in your wallabag to read it later. Then, when you open your wallabag, <strong>you can comfortably read your articles</strong>.</p>\n<h2>How to use wallabag</h2>\n<p>There are two ways to use wallabag: you can <a href=\"http://www.wallabag.org/frequently-asked-questions/#How_can_I_install_wallabag_and_what_are_the_requirements\">install it</a> on your web server or you can <a href=\"http://app.inthepoche.com\">create an account</a> at Framabag (we install and upgrade wallabag for you).</p>\n</div>\n\n</div>\n",
50 "user_id": "1"
51 },
52 {
53 "0": "4",
54 "1": "Sans titre",
55 "2": "http:\/\/www.konradlischka.info\/2016\/01\/blog\/wie-ein-deutsches-start-up-mit-wagniskapital-die-marktluecke-fuer-lokalen-digitaljournalismus-schliessen-will\/",
56 "3": "0",
57 "4": "0",
58 "5": "[unable to retrieve full-text content]",
59 "6": "1",
60 "id": "4",
61 "title": "Sans titre",
62 "url": "http:\/\/www.konradlischka.info\/2016\/01\/blog\/wie-ein-deutsches-start-up-mit-wagniskapital-die-marktluecke-fuer-lokalen-digitaljournalismus-schliessen-will\/",
63 "is_read": "0",
64 "is_fav": "0",
65 "content": "[unable to retrieve full-text content]",
66 "user_id": "1",
67 "tags": ""
68 } 35 }
69] 36]
diff --git a/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json b/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json
index efa8faf2..0e30d95b 100644
--- a/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json
+++ b/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json
@@ -6,7 +6,7 @@
6 "is_archived": false, 6 "is_archived": false,
7 "created_at": "2016-09-08T11:55:58+0200", 7 "created_at": "2016-09-08T11:55:58+0200",
8 "updated_at": "2016-09-08T11:57:16+0200", 8 "updated_at": "2016-09-08T11:57:16+0200",
9 "is_starred": false, 9 "is_starred": true,
10 "content": "<div alt=\"li\">Édition <a href=\"https://blogs.mediapart.fr/edition/camedia-0\">CAMédia</a>\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/edition/camedia/article/180116/deux-nouvelles-editions-pour-debattre-dans-le-club-sur-la-laicite-et-sur-la-democratie\">Deux nouvelles éditions pour débattre dans le club sur la laïcité et sur la démocratie</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>CAMédia après un échange sur « l'éthique du débat » a lancé deux discussions , l'une sur le thème de la laïcité, l'autre ( encore en cours) sur celui de la démocratie. Nous sommes heureux de pouvoir signaler la création de deux nouvelles éditions participatives sur ces thèmes. Nous vous invitons à les lire et à participer à leurs débats.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/lucile-longre/blog/170116/de-limportance-de-rever-eloge-du-merveilleux\">De l'importance de rêver, éloge du merveilleux</a></h3>\n<p>17 janv. 2016 | Par </p>\n<p>Je parlerai ici des rêves comme moteur de vie, de ces rêves qui vous rattachent et vous font espérer à ce qu’il y a de plus humain dans l’homme, même au milieu de la plus noire des détresses.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/barbara-romagnan/blog/180116/fins-dune-toute-puissance\">Fin(s) d'une toute-puissance</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>En ce début d’année, je recommande la lecture du dernier ouvrage de Guillaume Duval, La France ne sera jamais plus une grande puissance ? Tant mieux !</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/jean-pierre-thibaudat/blog/170116/l-allier-departement-de-destruction-massive-du-tissu-culturel\">L’Allier, département de destruction massive du tissu culturel</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>Les temps sont durs pour les petites structures, les associations culturelles qui, de bourgades en villages, travaillent au cœur des régions. Leurs subventions sont souvent revues à la baisse. Le département de l’Allier les a carrément supprimées. Pour favoriser « l’événementiel ».</p>\n</div><div alt=\"li\">Édition <a href=\"https://blogs.mediapart.fr/edition/les-invites-de-mediapart\">Les invités de Mediapart</a>\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/edition/les-invites-de-mediapart/article/180116/la-democratie-deja-attaquee-par-la-cooperation-reglementaire-transatlantiqu\">La démocratie déjà attaquée par la coopération réglementaire transatlantique</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>Lora Verheecke et David Lundy travaillent pour Corporate Europe Observatory, une ONG basée à Bruxelles qui enquête sur le pouvoir des lobbies des grandes entreprises sur la politique de l’Union européenne. Ils révèlent que depuis 25 ans le projet de « coopération réglementaire » mené par l’Union européenne et les États-Unis a été dominé par les grandes entreprises. ET que le TTIP cherche à entériner ce projet.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/jacqueline-derens/blog/180116/2016-une-annee-test-pour-jacob-zuma-et-son-gouvernement\">2016, une année test pour Jacob Zuma et son gouvernement</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>Les turbulences de l’an passé ont toutes les chances de continuer à troubler le climat politique et social de l’Afrique du Sud en 2016. La situation exige des changements profonds dans la conduite des affaires du pays. Jacob Zuma tout en admettant la nécessité de ces changements, est-il l’homme de la situation ? Son gouvernement répondra-t-il aux attentes des citoyens sud-africains ?</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/marie-cosnay/blog/140116/un-mal-fou-janvier-2016\">Un mal fou (janvier 2016)</a></h3>\n<p>14 janv. 2016 | Par </p>\n<p>J’ai une fringale d’aventure, d’aventures à venir. J’ai la fringale de la fringale des aventures et soudain, rupture. Je n’y arrive plus, tout est bloqué, tout empêché. Faut dire que depuis un an environ, tout est devenu plus compliqué. Ecrire va de moins en moins de soi.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/jean-pierre-veran/blog/170116/redoublement-le-changement-bas-bruit\">Redoublement : le changement à bas bruit ?</a></h3>\n<p>17 janv. 2016 | Par </p>\n<p>S’il est une caractéristique de la forme scolaire française bien établie dans la culture des personnels, des élèves et des parents, c’est bien le redoublement, censé sanctionner des résultats insuffisants pour envisager le passage dans la classe supérieure. Or, en ce domaine, l’évolution est nette.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/michel-de-pracontal/blog/160116/samedi-sciences-196-des-chasseurs-de-mammouths-en-arctique-il-y-45-000-ans\">Samedi-sciences (196): des chasseurs de mammouths en Arctique il y a 45 000 ans</a></h3>\n<p>16 janv. 2016 | Par <a href=\"https://blogs.mediapart.fr/michel-de-pracontal\" class=\"journalist\">Michel de Pracontal</a></p>\n<p>Les restes d’un mammouth retrouvés en Arctique sibérien, datés de 45 000 ans, portent les traces de blessures infligées par des chasseurs humains. Les scientifiques pensaient jusqu’ici que notre espèce ne s’était pas aventurée dans cette région glaciale il y a plus de 30 000 ou 35 0000 ans. En réalité, des hommes ont réussi à survivre en Arctique au moins 10 000 ans plus tôt que l’on croyait.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/alain-zolty/blog/140116/de-la-democratie-du-citoyen-et-de-lethique\">De la démocratie, du citoyen et de l'éthique</a></h3>\n<p>14 janv. 2016 | Par </p>\n<p>Trois ouvrages sont parus au Seuil, qui font état de la nécessité d’intégrer le citoyen dans la gouvernance de la nation. Non pas à titre consultatif mais doté d’un pouvoir délibératif pour constituer une contre-force face aux clans politico-financiers qui dominent la vie publique.</p>\n</div>", 10 "content": "<div alt=\"li\">Édition <a href=\"https://blogs.mediapart.fr/edition/camedia-0\">CAMédia</a>\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/edition/camedia/article/180116/deux-nouvelles-editions-pour-debattre-dans-le-club-sur-la-laicite-et-sur-la-democratie\">Deux nouvelles éditions pour débattre dans le club sur la laïcité et sur la démocratie</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>CAMédia après un échange sur « l'éthique du débat » a lancé deux discussions , l'une sur le thème de la laïcité, l'autre ( encore en cours) sur celui de la démocratie. Nous sommes heureux de pouvoir signaler la création de deux nouvelles éditions participatives sur ces thèmes. Nous vous invitons à les lire et à participer à leurs débats.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/lucile-longre/blog/170116/de-limportance-de-rever-eloge-du-merveilleux\">De l'importance de rêver, éloge du merveilleux</a></h3>\n<p>17 janv. 2016 | Par </p>\n<p>Je parlerai ici des rêves comme moteur de vie, de ces rêves qui vous rattachent et vous font espérer à ce qu’il y a de plus humain dans l’homme, même au milieu de la plus noire des détresses.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/barbara-romagnan/blog/180116/fins-dune-toute-puissance\">Fin(s) d'une toute-puissance</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>En ce début d’année, je recommande la lecture du dernier ouvrage de Guillaume Duval, La France ne sera jamais plus une grande puissance ? Tant mieux !</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/jean-pierre-thibaudat/blog/170116/l-allier-departement-de-destruction-massive-du-tissu-culturel\">L’Allier, département de destruction massive du tissu culturel</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>Les temps sont durs pour les petites structures, les associations culturelles qui, de bourgades en villages, travaillent au cœur des régions. Leurs subventions sont souvent revues à la baisse. Le département de l’Allier les a carrément supprimées. Pour favoriser « l’événementiel ».</p>\n</div><div alt=\"li\">Édition <a href=\"https://blogs.mediapart.fr/edition/les-invites-de-mediapart\">Les invités de Mediapart</a>\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/edition/les-invites-de-mediapart/article/180116/la-democratie-deja-attaquee-par-la-cooperation-reglementaire-transatlantiqu\">La démocratie déjà attaquée par la coopération réglementaire transatlantique</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>Lora Verheecke et David Lundy travaillent pour Corporate Europe Observatory, une ONG basée à Bruxelles qui enquête sur le pouvoir des lobbies des grandes entreprises sur la politique de l’Union européenne. Ils révèlent que depuis 25 ans le projet de « coopération réglementaire » mené par l’Union européenne et les États-Unis a été dominé par les grandes entreprises. ET que le TTIP cherche à entériner ce projet.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/jacqueline-derens/blog/180116/2016-une-annee-test-pour-jacob-zuma-et-son-gouvernement\">2016, une année test pour Jacob Zuma et son gouvernement</a></h3>\n<p>18 janv. 2016 | Par </p>\n<p>Les turbulences de l’an passé ont toutes les chances de continuer à troubler le climat politique et social de l’Afrique du Sud en 2016. La situation exige des changements profonds dans la conduite des affaires du pays. Jacob Zuma tout en admettant la nécessité de ces changements, est-il l’homme de la situation ? Son gouvernement répondra-t-il aux attentes des citoyens sud-africains ?</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/marie-cosnay/blog/140116/un-mal-fou-janvier-2016\">Un mal fou (janvier 2016)</a></h3>\n<p>14 janv. 2016 | Par </p>\n<p>J’ai une fringale d’aventure, d’aventures à venir. J’ai la fringale de la fringale des aventures et soudain, rupture. Je n’y arrive plus, tout est bloqué, tout empêché. Faut dire que depuis un an environ, tout est devenu plus compliqué. Ecrire va de moins en moins de soi.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/jean-pierre-veran/blog/170116/redoublement-le-changement-bas-bruit\">Redoublement : le changement à bas bruit ?</a></h3>\n<p>17 janv. 2016 | Par </p>\n<p>S’il est une caractéristique de la forme scolaire française bien établie dans la culture des personnels, des élèves et des parents, c’est bien le redoublement, censé sanctionner des résultats insuffisants pour envisager le passage dans la classe supérieure. Or, en ce domaine, l’évolution est nette.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/michel-de-pracontal/blog/160116/samedi-sciences-196-des-chasseurs-de-mammouths-en-arctique-il-y-45-000-ans\">Samedi-sciences (196): des chasseurs de mammouths en Arctique il y a 45 000 ans</a></h3>\n<p>16 janv. 2016 | Par <a href=\"https://blogs.mediapart.fr/michel-de-pracontal\" class=\"journalist\">Michel de Pracontal</a></p>\n<p>Les restes d’un mammouth retrouvés en Arctique sibérien, datés de 45 000 ans, portent les traces de blessures infligées par des chasseurs humains. Les scientifiques pensaient jusqu’ici que notre espèce ne s’était pas aventurée dans cette région glaciale il y a plus de 30 000 ou 35 0000 ans. En réalité, des hommes ont réussi à survivre en Arctique au moins 10 000 ans plus tôt que l’on croyait.</p>\n</div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https://blogs.mediapart.fr/alain-zolty/blog/140116/de-la-democratie-du-citoyen-et-de-lethique\">De la démocratie, du citoyen et de l'éthique</a></h3>\n<p>14 janv. 2016 | Par </p>\n<p>Trois ouvrages sont parus au Seuil, qui font état de la nécessité d’intégrer le citoyen dans la gouvernance de la nation. Non pas à titre consultatif mais doté d’un pouvoir délibératif pour constituer une contre-force face aux clans politico-financiers qui dominent la vie publique.</p>\n</div>",
11 "mimetype": "text/html", 11 "mimetype": "text/html",
12 "language": "fr", 12 "language": "fr",
@@ -96,299 +96,5 @@
96 "domain_name": "www.nationaljournal.com", 96 "domain_name": "www.nationaljournal.com",
97 "preview_picture": "https://www.nationaljournal.com/media/media/2015/09/17/06Julian-Assange.jpg", 97 "preview_picture": "https://www.nationaljournal.com/media/media/2015/09/17/06Julian-Assange.jpg",
98 "tags": [] 98 "tags": []
99 },
100 {
101 "is_archived": 0,
102 "created_at": "2016-09-08T11:55:58+0200",
103 "updated_at": "2016-09-08T11:57:16+0200",
104 "is_starred": 0,
105 "id": 605,
106 "title": "What David Cameron did to the pig, his party is now doing to the country",
107 "url": "http://www.newstatesman.com/2015/09/what-david-cameron-did-pig-his-party-now-doing-country",
108 "content": "<p>Whatever you do, don’t think about David Cameron and a dead pig. I know, I know it’s like trying not to think of an elephant, but the fact is that the allegations that the Prime Minister may have put a 'private part of his anatomy\" into a dead pig's mouth as part of an initiation ritual for an elite drinking society at Oxford University are actually a very serious matter, and it’s all about corruption and the nature of elected power, and it would help if we could all just calm down for a second and stop giggling. Don’t think I don’t see you at the back there.</p>\n<p>You know, I feel for David Cameron today, I really do. Politicians’ private sex lives should never be used against them - unless their particular proclivities implicate them in gross hypocrisy or they have harmed another human being. If the rumours are true, it’s unlikely that the pig in question was hurt by the Prime Minister’s ministrations, given that it was already missing its limbs and torso.</p>\n<p>Sniggering aside, this is unlikely to hurt David Cameron in the long run. He’s not looking for re-election, and besides, everyone knows posh people get up to weird sex stuff. Weird sex stuff is as British as weak tea and racism. When I was at Oxford, it was an open secret that the posh kids had naughty parties, and, of course, so did the rest of us - the difference was the much lower budget, and the fact that the posh kids didn’t seem to enjoy it as much as we did. It all seemed to be more about getting on than getting off. You didn’t shag or not shag the pig’s face because that was what you were into, you did it because you had your eye on a safe seat in Dorset in 20 years’ time and you needed to make the right friends.</p>\n<p>There is a reason that David Cameron is allowed to hold office when everyone assumes he spent the 1980s taking drugs and getting up to weird things with his Eton mates, but Jeremy Corbyn is considered unelectable because he didn’t sing the national anthem last week. Cameron is part of a select group of people to whom different rules apply, and he knows it, and his friends know it, and the tabloids know it, and the whole cosy British political machine knows it. This is why Corbyn will spend the next five years being savaged for having a slightly rumpled tie by the same newspapers that reported on the dead pig allegations under the title \"the making of an extraordinary Prime Minister\".</p>\n<p>The thing that's really horrifying about what has already been dubbed the 'Hameron' scandal is that it demonstrates what entitlement of this kind actually means, and how embarrassing it all is. There are people out there who can spend their early twenties in close proximity to cocaine and popping their peckers in offal and not even consider for a second that there might be anyone better placed to run the country. These are people who know the rules don’t apply to them, who know they can do whatever they want and still end up in charge. </p>\n<p>I don't honestly care whether or not David Cameron shagged a dead pig. I've been to enough house parties in Bethnal Green that this sort of thing doesn't shock me. Come back to me when there’s video evidence of Cameron dressed in a leather gimp-suit tanned from the flayed skins of the former shadow cabinet, leaping into an entire Shropshire field full of pigs and screaming that his name is Legion. Then we’ll talk. There are a lot of things that David Cameron has definitely done that I do find disgusting, though. Taking away benefits from sick and disabled people, pricing poor kids out of higher education, and forcing millions of families to rely on food banks. That, to me, is shocking and grotesque. I don't give a damn about what he did or didn’t do to that pig, and whether there was mood-lighting involved. </p>\n<p>But the fact is that a lot of people do, and they're precisely the sort of people whose votes Cameron has relied on to shore up the power he clearly feels is his by right, might and various dodgy initiation rituals involving sex workers, smashing up pubs and knobbing bits of meat. Cameron clearly believes those people are there to be manipulated, and that’s the reason this story actually matters, beyond the immediate risk that a handful of pearl-clutchers in the Home Counties might splutter themselves to death. </p>\n<p>I was explaining all this to an American friend who asked, not unreasonably, why I'd spent all morning scrolling through Twitter and cackling like a toddler with a nerf gun. I did my best to describe seriously what had happened, and my friend, who does not follow British politics, asked me, 'so this guy, was he elected or appointed?'</p>\n<p>The answer, of course, is both. David Cameron is not just prime minister because a quarter of the country voted for him. That's not how power works in Britain, or anywhere, and it's moments like this that show it plainly, which is why we're all vaguely embarrassed today. Cameron's route to the office he clearly believes himself born to began much earlier, possibly even on a balmy Oxford night, just Dave, a dead pig and a select group of wide-eyed, gurning future business leaders, all whooping and cheering.</p>\n<p>It would surely have been a moment more important to Cameron's career than any number of photoshoots with builders in Totnes. Power and money are accessed through the back door, or, as it may be, the pig's mouth, and as with any kink, the eroticism isn't about the act, but about what the act symbolises. It's about humiliation, about control, about power play. What might the young swain have been thinking as he unzipped? What went through his head? If you ask me, I'll bet he was thinking: <em>Soon. Someday soon, I will do this to the whole bloody country.</em></p>\n",
109 "annotations": [],
110 "mimetype": "text/html",
111 "language": "en",
112 "reading_time": 5,
113 "domain_name": "www.newstatesman.com",
114 "preview_picture": "http://www.newstatesman.com/sites/default/files/styles/thumb_730/public/blogs_2015/09/gettyimages-464604046.jpg?itok=EaABrZda",
115 "tags": []
116 },
117 {
118 "is_archived": 1,
119 "created_at": "2016-09-08T11:55:58+0200",
120 "updated_at": "2016-09-08T11:57:16+0200",
121 "is_starred": 0,
122 "id": 604,
123 "title": "CLICK HERE to support 2016 CES Winner, Revolutionary Auto-Tracking Robot",
124 "url": "https://www.indiegogo.com/projects/2016-ces-winner-revolutionary-auto-tracking-robot",
125 "content": "<div class=\"visible-xs visible-sm\" readability=\"8\">\n<div class=\"row\" readability=\"12\">\n<section class=\"col-sm-8\" readability=\"8\"><p>Sign Up for Inspiration</p>\n<p>Private, secure, spam-free</p>\n</section><section class=\"col-sm-4 i-top-lined-mobile-only\"><p>Follow us</p>\n </section></div>\n<div class=\"row\" readability=\"9\">\n<section class=\"col-sm-8 i-top-lined\" readability=\"5\"><p>About Indiegogo</p>\n</section><section class=\"col-sm-4 i-top-lined\"><div class=\"row\">\n<p>Language</p>\n</div>\n</section></div>\n</div>\n<div class=\"visible-md visible-lg\" readability=\"13\">\n<section class=\"row\" readability=\"4\"><div class=\"col-md-3\">\n<p>Campaigning</p>\n </div>\n<div class=\"col-md-3\">\n<p>Contributing</p>\n </div>\n<div class=\"col-md-6\" readability=\"13\">\n<p>Sign Up for Inspiration</p>\n<p>Private, secure, spam-free</p>\n</div>\n</section><section class=\"row\"><div class=\"col-md-3\">\n<p>About Indiegogo</p>\n </div>\n<div class=\"col-md-4\">\n<p>Follow us</p>\n</div>\n<div class=\"col-md-2\">\n<p>Language</p>\n</div>\n</section></div>\n<section class=\"i-top-lined\" readability=\"1\">\n</section>",
126 "annotations": [],
127 "mimetype": "text/html",
128 "reading_time": 0,
129 "domain_name": "www.indiegogo.com",
130 "preview_picture": "https://c1.iggcdn.com/indiegogo-media-prod-cld/image/upload/c_fill,f_auto,h_630,w_1200/v1447395263/d6ckex9ynild6ica1xdk.jpg",
131 "tags": []
132 },
133 {
134 "is_archived": 0,
135 "created_at": "2016-09-08T11:55:58+0200",
136 "updated_at": "2016-09-08T11:57:16+0200",
137 "is_starred": 1,
138 "id": 603,
139 "title": "No title found",
140 "url": "http://carnetdevol.shost.ca/wordpress/aide-memoire-sur-les-commandes-associees-a-systemd/",
141 "content": "wallabag can't retrieve contents for this article. Please report this issue to us.",
142 "annotations": [],
143 "mimetype": "text/html",
144 "reading_time": 0,
145 "domain_name": "carnetdevol.shost.ca",
146 "tags": []
147 },
148 {
149 "is_archived": 1,
150 "created_at": "2016-09-08T11:55:58+0200",
151 "updated_at": "2016-09-08T11:57:16+0200",
152 "is_starred": 0,
153 "id": 602,
154 "title": "Présentation d'Arduino - Tuto Arduino - Le blog d'Eskimon",
155 "url": "http://eskimon.fr/73-arduino-101-presentation",
156 "content": "<div class=\"chapitre\" id=\"457282\">\n<p class=\"introduction\">Comment faire de l’électronique en utilisant un langage de programmation ? La réponse, c’est le projet Arduino qui l’apporte. Vous allez le voir, celui-ci a été conçu pour être accessible à tous par sa simplicité. Mais il peut également être d’usage professionnel, tant les possibilités d’applications sont nombreuses.</p>\n<div class=\"sommaire\"><strong class=\"tgros\">Sommaire</strong>\n<ul><li><a href=\"http://eskimon.fr/73-arduino-101-presentation#457704\">Qu’est-ce que c’est ?</a></li>\n<li><a href=\"http://eskimon.fr/73-arduino-101-presentation#769345\">Pourquoi choisir Arduino ?</a></li>\n<li><a href=\"http://eskimon.fr/73-arduino-101-presentation#458252\">Les cartes Arduino</a></li>\n<li><a href=\"http://eskimon.fr/73-arduino-101-presentation#629075\">Liste d’achat</a></li>\n</ul></div>\n<div class=\"sideSommaire blocwrapper\"><ins class=\"adsbygoogle c1\" data-ad-client=\"ca-pub-2080155902357792\" data-ad-slot=\"1103196807\"/></div>\n<div class=\"sousparties\">\n<div class=\"souspartie\" id=\"457704\">\n<h2>Qu’est-ce que c’est ?</h2>\n<div class=\"texte\">Une équipe de développeurs composée de <em>Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, David Mellis et Nicholas Zambetti</em> a imaginé un projet répondant au doux nom de <strong>Arduino</strong> et mettant en œuvre une petite carte électronique programmable et un logiciel multiplateforme, qui puisse être accessible à tout un chacun dans le but de créer facilement des systèmes électroniques. Étant donné qu’il y a des débutants parmi nous, commençons par voir un peu le vocabulaire commun propre au domaine de l’électronique et de l’informatique.\n<h3>Une carte électronique</h3>\n<p>Une <strong>carte électronique</strong> est un support plan, flexible ou rigide, généralement composé d’<a href=\"http://fr.wikipedia.org/wiki/Poly%C3%A9poxyde\">epoxy</a> ou de fibre de verre. Elle possède des pistes électriques disposées sur une, deux ou plusieurs couches (en surface et/ou en interne) qui permettent la mise en relation électrique des composants électroniques. Chaque piste relie tel composant à tel autre, de façon à créer un système électronique qui fonctionne et qui réalise les opérations demandées.</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422585.png\"/><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422584.png\"/><br/><em>Exemples de cartes électroniques</em></div>\n<p>Évidemment, tous les composants d’une carte électronique ne sont pas forcément reliés entre eux. Le câblage des composants suit un plan spécifique à chaque carte électronique, qui se nomme le <strong>schéma électronique</strong>.</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422580.png\"/><br/><em>Exemple de schéma électronique – carte Arduino Uno</em></div>\n<p>Enfin, avant de passer à la réalisation d’un carte électronique, il est nécessaire de transformer le schéma électronique en un <strong>schéma de câblage</strong>, appelé <strong>typon</strong>.</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422582.png\"/><br/><em>Exemple de typon – carte Arduino</em></div>\n<p class=\"question\">Une fois que l’on a une carte électronique, on fait quoi avec ?</p>\n<p>Eh bien une fois que la carte électronique est faite, nous n’avons plus qu’à la tester et l’utiliser ! Dans notre cas, avec Arduino, nous n’aurons pas à fabriquer la carte et encore moins à la concevoir. Elle existe, elle est déjà prête à l’emploi et nous n’avons plus qu’à l’utiliser. Et pour cela, vous allez devoir apprendre comment l’utiliser, ce que je vais vous montrer dans ce tutoriel.</p>\n<h3>Programmable ?</h3>\n<p>J’ai parlé de <strong>carte électronique programmable</strong> au début de ce chapitre. Mais savez-vous ce que c’est exactement ? Non pas vraiment. Alors voyons ensemble de quoi il s’agit. La carte Arduino est une carte électronique qui ne sait rien faire sans qu’on lui dise quoi faire. Pourquoi ? Eh bien c’est du au fait qu’elle est <strong>programmable</strong>. Cela signifie qu’elle a besoin d’un <strong>programme</strong> pour fonctionner.</p>\n<h4>Un programme</h4>\n<p>Un programme est une liste d’instructions qui est exécuté par un système. Par exemple votre navigateur internet, avec lequel vous lisez probablement ce cours, est un programme. On peut analogiquement faire référence à une liste de course :</p>\n<div class=\"gauche\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422587.png\"/></div>\n<p>Chaque élément de cette liste est une <strong>instruction</strong> qui vous dis : « Va chercher le lait » ou « Va chercher le pain », etc. Dans un programme le fonctionnement est similaire :</p>\n<ul><li>Attendre que l’utilisateur rentre un site internet à consulter</li>\n<li>Rechercher sur internet la page demandée</li>\n<li>Afficher le résultat</li>\n</ul><p>Tel pourrait être le fonctionnement de votre navigateur internet. Il va attendre que vous lui demandiez quelque chose pour aller le chercher et ensuite vous le montrer. Eh bien, tout aussi simplement que ces deux cas, une carte électronique programmable suit une liste d’instructions pour effectuer les opérations demandées par le programme.</p>\n<p class=\"question\">Et on les trouves où ces programmes ? Comment on fait pour le mettre dans la carte ? o_O</p>\n<p>Des programmes, on peut en trouver de partout. Mais restons concentré sur Arduino. Le programme que nous allons mettre dans la carte Arduino, c’est nous qui allons le réaliser. Oui, vous avez bien lu. Nous allons programmer cette carte Arduino. Bien sûr, ce ne sera pas aussi simple qu’une liste de course, mais rassurez-vous cependant car nous allons réussir quand même ! Je vous montrerais comment y parvenir, puisque avant tout c’est un des objectifs de ce tutoriel. Voici un exemple de programme : <img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422588.png\"/> Vous le voyez comme moi, il s’agit de plusieurs lignes de texte, chacune étant une instruction. Ce langage ressemble à un véritable baragouin et ne semble vouloir <em>à priori</em> rien dire du tout… Et pourtant, c’est ce que nous saurons faire dans quelques temps ! Car nous apprendrons le <strong>langage informatique</strong> utilisé pour programmer la carte Arduino. Je ne m’attarde pas sur les détails, nous aurons amplement le temps de revenir sur le sujet plus tard. Pour répondre à la deuxième question, nous allons avoir besoin d’un logiciel…</p>\n<h3>Et un logiciel ?</h3>\n<p>Bon, je ne vais pas vous faire le détail de ce qu’est un logiciel, vous savez sans aucun doute de quoi il s’agit. Ce n’est autre qu’un programme informatique exécuté sur un ordinateur. Oui, pour programmer la carte Arduino, nous allons utiliser un programme ! En fait, il va s’agir d’un <strong>compilateur</strong>. Alors qu’est-ce que c’est exactement ?</p>\n<h4>Un compilateur</h4>\n<p>En informatique, ce terme désigne un logiciel qui est capable de traduire un langage informatique, ou plutôt un programme utilisant un langage informatique, vers un langage plus approprié afin que la machine qui va le lire puisse le comprendre. C’est un peu comme si le patron anglais d’une firme Chinoise donnait des instructions en anglais à un de ses ouvriers chinois. L’ouvrier ne pourrait comprendre ce qu’il doit faire. Pour cela, il a besoin que l’on traduise ce que lui dit son patron. C’est le rôle du <strong>traducteur</strong>. Le compilateur va donc traduire les instructions du programme précédent, écrites en langage texte, vers un langage dit « machine ». Ce langage utilise uniquement des 0 et des 1. Nous verrons plus tard pourquoi. Cela pourrait être imagé de la façon suivante :</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422590.png\"/></div>\n<p>Donc, pour traduire le langage texte vers le langage machine (avec des 0 et des 1), nous aurons besoin de ce fameux compilateur. Et pas n’importe lequel, il faut celui qui soit capable de traduire le langage texte Arduino vers le langage machine Arduino. Et oui, sinon rien ne va fonctionner. Si vous mettez un traducteur Français vers Allemand entre notre patron anglais et son ouvrier chinois, ça ne fonctionnera pas mieux que s’ils discutaient directement. Vous comprenez ?</p>\n<p class=\"question\">Et pourquoi on doit utiliser un traducteur, on peut pas simplement apprendre le langage machine directement ?</p>\n<p>Comment dire… non ! Non parce que le langage machine est quasiment impossible à utiliser tel quel. Par exemple, comme il est composé de 0 et de 1, si je vous montre ça : « 0001011100111010101000111 », vous serez incapable, tout comme moi, de dire ce que cela signifie ! Et même si je vous dis que la suite « 01000001 » correspond à la lettre « A », je vous donne bien du courage pour coder rien qu’une phrase ! 😛 Bref, oubliez cette idée. C’est quand même plus facile d’utiliser des mots anglais (car oui nous allons être obligé de faire un peu d’anglais pour programmer, mais rien de bien compliqué rassure-vous) que des suites de 0 et de 1. Vous ne croyez pas ?</p>\n<h4>Envoyer le programme dans la carte</h4>\n<p>Là, je ne vais pas vous dire grand chose car c’est l’environnement de développement qui va gérer tout ça. Nous n’aurons qu’à apprendre comment utiliser ce dernier et il se débrouillera tout seul pour envoyer le programme dans la carte. Nah ! Nous n’aurons donc qu’à créer le programme sans nous soucier du reste.</p>\n</div>\n</div>\n<div class=\"souspartie\" id=\"769345\">\n<h2>Pourquoi choisir Arduino ?</h2>\n<div class=\"texte\">\n<h3>Que va-t-on faire avec ?</h3>\n<p>Avec Arduino, nous allons commencer par apprendre à programmer puis à utiliser des composants électroniques. Au final, nous saurons créer des systèmes électroniques plus ou moins complexes. Mais ce n’est pas tout…</p>\n<h4>D’abord, Arduino c’est…</h4>\n<p>… une carte électronique programmable et un logiciel gratuit :</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/307927.png\"/></div>\n<h4>Mais aussi</h4>\n<p>– Un prix dérisoire étant donné l’étendue des applications possibles. On comptera 20 euros pour la carte que l’on va utiliser dans le cours. Le logiciel est fournit gratuitement ! – Une compatibilité sous toutes les plateformes, à savoir : Windows, Linux et Mac OS. – Une communauté ultra développée ! Des milliers de forums d’entre-aide, de présentations de projets, de propositions de programmes et de bibliothèques, … – Un site en anglais <a href=\"http://www.arduino.cc/\">arduino.cc</a> et un autre en français <a href=\"http://www.arduino.cc/\">arduino.cc</a> où vous trouverez tout de la référence Arduino, le matériel, des exemples d’utilisations, de l’aide pour débuter, des explications sur le logiciel et le matériel, etc. – Une liberté quasi absolue. Elle constitue en elle même deux choses :</p>\n<ul><li>Le logiciel : gratuit et open source, développé en Java, dont la simplicité d’utilisation relève du savoir cliquer sur la souris</li>\n<li>Le matériel : cartes électroniques dont les schémas sont en libre circulation sur internet</li>\n</ul><p class=\"attention\">Cette liberté a une condition : le nom « Arduino » ne doit être employé que pour les cartes « officielles ». En somme, vous ne pouvez pas fabriquer votre propre carte sur le modèle Arduino et lui assigner le nom « Arduino ».</p>\n<h4>Et enfin, les applications possibles</h4>\n<p>Voici une liste non exhaustive des applications possible réalisées grâce à Arduino :</p>\n<ul><li>contrôler des appareils domestiques</li>\n<li>donner une « intelligence » à un robot</li>\n<li>réaliser des jeux de lumières</li>\n<li>permettre à un ordinateur de communiquer avec une carte électronique et différents capteurs</li>\n<li>télécommander un appareil mobile (modélisme)</li>\n<li>etc.</li>\n</ul><p>Il y a tellement d’autres infinités d’utilisations, vous pouvez simplement chercher sur votre moteur de recherche préféré ou sur Youtube le mot « Arduino » pour découvrir les milliers de projets réalisés avec !</p>\n<h4>Arduino dans ce tutoriel</h4>\n<p>Je vais quand même rappeler les principaux objectifs de ce cours. Nous allons avant tout découvrir Arduino dans son ensemble et apprendre à l’utiliser. Dans un premier temps, il s’agira de vous présenter ce qu’est Arduino, comment cela fonctionne globalement, pour ensuite entrer un peu plus dans le détail. Nous allons alors apprendre à utiliser le langage Arduino pour pouvoir créer des programmes très simple pour débuter. Nous enchainerons ensuite avec les différentes fonctionnalités de la carte et ferons de petits TP qui vous permettront d’assimiler chaque notion abordée. Dès lors que vous serez plutôt à l’aise avec toutes les bases, nous nous rapprocherons de l’utilisation de composants électroniques plus ou moins complexes et finirons par un plus « gros » TP alliant la programmation et l’électronique. De quoi vous mettre de l’eau à la bouche ! 😛</p>\n<h3>Arduino à l’école ?</h3>\n<p>Pédagogiquement, Arduino a aussi pas mal d’atout. En effet, ses créateurs ont d’abord pensé ce projet pour qu’il soit facile d’accès. Il permet ainsi une très bonne approche de nombreux domaines et ainsi d’apprendre plein de choses assez simplement.</p>\n<h4>Des exemples</h4>\n<p>Voici quelques exemples d’utilisation possible :</p>\n<ul><li>Simuler le fonctionnement des portes logiques</li>\n<li>Permettre l’utilisation de différents capteurs</li>\n<li>Mettre en œuvre et faciliter la compréhension d’un réseau informatique</li>\n<li>Se servir d’Arduino pour créer des maquettes animées montrant le fonctionnement des collisions entres les plaques de la croute terrestre, par exemple <img src=\"http://eskimon.fr/wp-includes/images/smilies/mrgreen.png\" alt=\":mrgreen:\" class=\"wp-smiley c2\"/></li>\n<li>Donner un exemple concret d’utilisation des matrices avec un clavier alphanumérique 16 touches ou plus</li>\n<li>Être la base pour des élèves ayant un TPE à faire pour le BAC</li>\n<li>…</li>\n</ul><p>De plus, énormément de ressources et tutoriels (mais souvent en anglais) se trouvent sur internet, ce qui offre un autonomie particulière à l’apprenant.</p>\n<h4>Des outils existant !</h4>\n<p>Enfin, pour terminer de vous convaincre d’utiliser Arduino pour découvrir le monde merveilleux de l’embarqué, il existe différents outils qui puissent être utilisé avec Arduino. Je vais en citer deux qui me semble être les principaux : <a href=\"http://blog.ardublock.com/\">Ardublock</a> est un outil qui se greffe au logiciel Arduino et qui permet de programmer avec des blocs. Chaque bloc est une instruction. On peut aisément faire des programmes avec cet outil et mêmes des plutôt complexes. Cela permet par exemple de se concentrer sur ce que l’on doit faire avec Arduino et non se concentrer sur Arduino pour ensuite ce que l’on doit comprendre avec. Citons entre autre la simulation de porte logique : plutôt créer des programmes rapidement sans connaitre le langage pour comprendre plus facilement comment fonctionne une porte logique. Et ce n’est qu’un exemple. Car cela permet aussi de permettre à de jeunes enfants de commencer à programmer sans de trop grandes complications.</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422596.png\"/><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422595.png\"/><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422597.png\"/><br/><em>Exemple de programmes réalisés avec Ardublock</em></div>\n<p><a href=\"http://processing.org/\">Processing</a> est une autre plateforme en lien avec Arduino. Là il n’y a pas de matériel, uniquement un logiciel. Il permet entre autre de créer des interfaces graphiques avec un langage de programmation très similaire à celui d’Arduino. Par contre, cela demande un niveau un peu plus élevé pour pouvoir l’utiliser, même si cela reste simple dans l’ensemble.</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422599.png\"/><br/><em>Voilà un exemple de ce que j’avais réalisé avec Processing pour faire communiquer mon ordinateur avec ma carte Arduino</em></div>\n<p>J’espère avoir été assez convaincant afin que vous franchissiez le pas et ayez du plaisir à apprendre ! <img src=\"http://eskimon.fr/wp-includes/images/smilies/simple-smile.png\" alt=\":)\" class=\"wp-smiley c2\"/></p>\n</div>\n</div>\n<div class=\"souspartie\" id=\"458252\">\n<h2>Les cartes Arduino</h2>\n<div class=\"texte\">Le matériel que j’ai choisi d’utiliser tout au long de ce cours n’a pas un prix excessif et, je l’ai dit, tourne aux alentours de 25 € TTC. Il existe plusieurs magasins en lignes et en boutiques qui vendent des cartes Arduino. Je vais vous en donner quelques-uns, mais avant, il va falloir différencier certaines choses.\n<h4>Les fabricants</h4>\n<p>Le projet Arduino est libre et les schémas des cartes circulent librement sur internet. D’où la mise en garde que je vais faire : il se peut qu’un illustre inconnu fabrique lui même ses cartes Arduino. Cela n’a rien de mal en soi, s’il veut les commercialiser, il peut. Mais s’il est malhonnête, il peut vous vendre un produit défectueux. Bien sûr, tout le monde ne cherchera pas à vous arnaquer. Mais la prudence est de rigueur. Faites donc attention où vous achetez vos cartes.</p>\n<h4>Les types de cartes</h4>\n<div class=\"floatDroite\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422602.gif\"/></div>\n<p>Il y a trois types de cartes :</p>\n<ul><li>Lesdites « officielles » qui sont fabriquées en Italie par le fabricant officiel : <em>Smart Projects</em></li>\n<li>Lesdits « compatibles » qui ne sont pas fabriqués par <em>Smart Projects</em>, mais qui sont totalement compatibles avec les Arduino officielles.</li>\n<li>Les « autres » fabriquées par diverse entreprise et commercialisées sous un nom différent (Freeduino, Seeduino, Femtoduino, …).</li>\n</ul><h4>Les différentes cartes</h4>\n<p>Des cartes Arduino il en existe beaucoup ! Voyons celles qui nous intéressent… <strong>La carte <em>Uno</em> et <em>Duemilanove</em></strong> Nous choisirons d’utiliser la carte portant le nom de « Uno » ou « Duemilanove ». Ces deux versions sont presque identiques.</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422601.png\"/><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422600.gif\"/><br/><em>Carte Arduino « Duemilavove » et « Uno » avec laquelle nous allons travailler</em></div>\n<p><strong>La carte <em>Mega</em></strong> La carte Arduino Mega est une autre carte qui offre toutes les fonctionnalités de la carte précédente, mais avec des fonctionnalités supplémentaires. On retrouve notamment un nombre d’entrées et de sorties plus important ainsi que plusieurs liaisons séries. Bien sûr, le prix est plus élevé : &gt; 40 € !</p>\n<div class=\"centre\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422586.png\"/><br/><em>Carte Arduino « Mega »</em></div>\n<p><strong>Les autres cartes</strong> Il existe encore beaucoup d’autres cartes, je vous laisse vous débrouiller pour trouver celle qui conviendra à vos projets. Cela dit, je vous conseil dans un premier temps d’utiliser la carte Arduino Uno ou Duemilanove d’une part car elle vous sera largement suffisante pour débuter et d’autre part car c’est avec celle-ci que nous présentons le cours.</p>\n<h4>Où acheter ?</h4>\n<p>Il existe sur le net une multitude de magasins qui proposent des cartes Arduino. Pour consulter la liste de ces magasins, rien de plus simple, il suffit de vous rendre sur le forum dédié :</p>\n<div class=\"centre\"><a href=\"http://fr.openclassrooms.com/forum/sujet/les-meilleures-boutiques-d-electronique-90967\"><strong>Les meilleurs boutiques d’électronique</strong></a> Cliquez-ici</div>\n<p class=\"question\">J’ai vu des cartes officielles « édition SMD/CMS ». Ca à l’air bien aussi, c’est quoi la différence ? Je peux m’en servir ?</p>\n<p>Il n’y a pas de différence ! enfin presque… « SMD » signifie <strong>Surface Mount Device</strong>, en français on appelle ça des « CMS » pour <strong>Composants Montés en Surface</strong>. Ces composants sont soudés directement sur le cuivre de la carte, il ne la traverse pas comme les autres. Pour les cartes Arduino, on retrouve le composant principal en édition SMD dans ces cartes. La carte est donc la même, aucune différence pour le tuto. Les composants sont les mêmes, seule l’allure « physique » est différente. Par exemple, ci-dessus la « Mega » est en SMD et la Uno est « classique ».</p>\n</div>\n</div>\n<div class=\"souspartie\" id=\"629075\">\n<h2>Liste d’achat</h2>\n<div class=\"texte\">Tout au long du cours, nous allons utiliser du matériel en supplément de la carte. Rassurez-vous le prix est bien moindre. Je vous donne cette liste, cela vous évitera d’acheter en plusieurs fois. Vous allez devoir me croire sur parole sur leur intérêt. Nous découvrirons comment chaque composant fonctionne et comment les utiliser tout au long du tutoriel. <img src=\"http://eskimon.fr/wp-includes/images/smilies/simple-smile.png\" alt=\":)\" class=\"wp-smiley c2\"/><p class=\"attention\">Attention, cette liste ne contient que les composants en quantités minimales strictes. Libre à vous de prendre plus de LED et de résistances par exemple (au cas où vous en perdriez ou détruisiez…). Pour ce qui est des prix, j’ai regardé sur différents sites grands publics (donc pas Farnell par exemple), ils peuvent donc paraître plus élevé que la normale dans la mesure où ces sites amortissent moins sur des ventes à des clients fidèles qui prennent tout en grande quantité…</p>\n<p>Avant que j’oublie, quatres éléments n’apparaitront pas dans la liste et sont indispensables :</p>\n<table><tbody><tr><th>Une Arduino Uno ou Duemilanove</th>\n<th>Un câble USB A mâle/B mâle</th>\n</tr><tr><td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369652.gif\"/></td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/422603.png\"/></td>\n</tr></tbody></table><table><tbody><tr><th>Une BreadBoard (plaque d’essai)</th>\n<th>Un lot de fils pour brancher le tout !</th>\n</tr><tr><td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369653.jpg\"/></td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369661.png\"/></td>\n</tr></tbody></table><h3>Liste Globale</h3>\n<p>Voici donc la liste du matériel nécessaire pour suivre le cours. Libre à vous de tout acheter ou non.</p>\n<div class=\"erreur\">Liste incomplète, le tutoriel n’est pas terminé ! Mais elle suffit pour suivre les chapitres en ligne.</div>\n<table><tbody><tr><th>Désignation</th>\n<th>Quantité</th>\n<th>Photo</th>\n<th>Description</th>\n</tr><tr><td>LED rouge</td>\n<td>7</td>\n<td rowspan=\"3\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369662.png\"/></td>\n<td rowspan=\"3\">Ce composant est une sorte de lampe un peu spécial. Nous nous en servirons principalement pour faire de la signalisation.</td>\n</tr><tr><td>LED verte</td>\n<td>3</td>\n</tr><tr><td>LED jaune (ou orange)</td>\n<td>2</td>\n</tr><tr><td>Résistance (entre 220 et 470 Ohm)</td>\n<td>10</td>\n<td rowspan=\"3\"><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369663.png\"/></td>\n<td rowspan=\"3\">La résistance est un composant de base qui s’oppose au passage du courant. On s’en sert pour limiter des courants maximums mais aussi pour d’autres choses.</td>\n</tr><tr><td>Résistance (entre 2.2 et 4.7 kOhm)</td>\n<td>2</td>\n</tr><tr><td>Résistance (10 kOhm)</td>\n<td>2</td>\n</tr><tr><td>Bouton Poussoir</td>\n<td>2</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369665.jpg\"/></td>\n<td>Un bouton poussoir sert à faire passer le courant lorsqu’on appuie dessus ou au contraire garder le circuit « éteint » lorsqu’il est relâché.</td>\n</tr><tr><td>Transistor (2N2222 ou BC547)</td>\n<td>2</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369664.png\"/></td>\n<td>Le transistor sert à plein de chose. Il peut être utilisé pour faire de l’amplification (de courant ou de tension) mais aussi comme un interrupteur commandé électriquement.</td>\n</tr><tr><td>Afficheur 7 segments (anode commune)</td>\n<td>2</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/345467.png\"/></td>\n<td>Un afficheur 7 segments est un ensemble de LEDs (cf. ci-dessus) disposées géométriquement pour afficher des chiffres.</td>\n</tr><tr><td>Décodeur BCD (CD4543BE)</td>\n<td>1</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369667.png\"/></td>\n<td>Le décodeur BCD (Binaire Codé Décimal) permet piloter des afficheurs 7 segments en limitant le nombre de fils de données (4 au lieu de 7).</td>\n</tr><tr><td>Condensateur (10nF/5V ou plus)</td>\n<td>2</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369673.jpg\"/></td>\n<td>Le condensateur est un composant de base. Il sert à plein de chose. On peut se le représenter comme un petit réservoir à électricité.</td>\n</tr><tr><td>Condensateur (1000µF 15V ou plus</td>\n<td>1</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/370226.png\"/></td>\n<td>Celui-ci est un plus gros réservoir que le précédent</td>\n</tr><tr><td>Potentiomètre linéaire (10 kOhm)</td>\n<td>1</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369668.png\"/></td>\n<td>Le potentiomètre est une résistance que l’on peut faire varier manuellement.</td>\n</tr><tr><td>LED RVB</td>\n<td>1</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/369672.jpg\"/></td>\n<td>Une LED RVB (Rouge Vert Bleu) est une LED permettant de mélanger les couleurs de bases pour en créer d’autres.</td>\n</tr><tr><td>Écran LCD alphanumérique</td>\n<td>1</td>\n<td><img alt=\"\" src=\"http://eskimon.fr/wp-content/uploads/tuto/385800.jpg\"/></td>\n<td>L’écran LCD alphanumérique permet d’afficher des caractères tels que les chiffres et les lettres. Il va apporter de l’interactivité à vos projets les plus fous !</td>\n</tr></tbody></table><h3>Les revendeurs</h3>\n<p>Je vous ai déjà donné le lien, vous pourrez trouver ces composants chez les revendeurs listés dans ce sujet du forum :</p>\n<div class=\"centre\"><a href=\"http://fr.openclassrooms.com/forum/sujet/les-meilleures-boutiques-d-electronique-90967\"><strong>Les meilleurs boutiques d’électronique</strong></a> Cliquez-ici</div>\n<h3>Les kits</h3>\n<p>Enfin, il existe des kits tout prêts chez certains revendeurs. Nous n’en conseillerons aucun pour plusieurs raisons. Tout d’abord, pour ne pas faire trop de publicité et rester conforme avec la charte du site. Ensuite, car il est difficile de trouver un kit « complet ». Ils ont tous des avantages et des inconvénients mais aucun (au moment de la publication de ces lignes) ne propose absolument tous les composants que nous allons utiliser. Nous ne voulons donc pas que vous reveniez vous plaindre sur les forums car nous vous aurions fait dépenser votre argent inutilement !</p>\n<div class=\"erreur\">Cela étant dit, merci de <strong>ne pas nous spammer de MP</strong> pour que l’on donne notre avis sur tel ou tel kit ! Usez des forums pour cela, il y a toujours quelqu’un qui sera là pour vous aider. Et puis nous n’avons pas les moyens de tous les acheter et tester leur qualité !</div>\n</div>\n</div>\n</div>\n<div class=\"conclusion\"/>\n</div>\n\n\n",
157 "annotations": [],
158 "mimetype": "text/html",
159 "language": "fr-FR",
160 "reading_time": 17,
161 "domain_name": "eskimon.fr",
162 "preview_picture": "http://eskimon.fr/wp-content/uploads/tuto/385800.jpg",
163 "tags": []
164 },
165 {
166 "is_archived": 1,
167 "created_at": "2016-09-08T11:55:58+0200",
168 "updated_at": "2016-09-08T11:57:16+0200",
169 "is_starred": 0,
170 "id": 543,
171 "title": "Lenovo ThinkPad X1 Carbon Ultrabook Review",
172 "url": "http://www.notebookcheck.net/Lenovo-ThinkPad-X1-Carbon-Ultrabook-Review.138033.0.html",
173 "content": "<p class=\"align-justify\">The Lenovo X1 Carbon 3rd Gen is <strong>a beautiful machine</strong>. Much like the <a href=\"http://www.notebookcheck.net/Dell-XPS-13-9343-Touchscreen-Ultrabook-Review.135817.0.html\" target=\"_self\" class=\"internal-link\">Dell XPS 13</a> took the initiative to cram a 13-inch screen into an 11-inch form factor, the X1 Carbon sports dimensions that are more comparable to a typical 13-inch machine—and that includes its <strong>weight and thinness</strong>, both of which are <strong>indisputably manageable</strong>. It’s also <strong>practically designed</strong>; the <strong>matte black surfaces</strong> that comprise the majority of the case are minimalist and attractive, but they’re simultaneously haptically comfortable, with an <strong>unmistakably cool metal feel</strong> and a comfortable fit for use on both lap and desk. The case also feels fairly solid, though the incidence of flex and relative lack of torsion resistance in some regards gave us pause.</p>\n<p class=\"align-justify\">Perhaps more exciting, however, is <strong>what has improved over the <a href=\"http://www.notebookcheck.net/Review-Update-Lenovo-ThinkPad-X1-Carbon-Touch-20A7-002DGE-Ultrabook.113926.0.html\" target=\"_self\" class=\"internal-link\">X1 Carbon 2nd Gen</a></strong>. Criticism of the <a href=\"http://www.notebookcheck.net/Review-Update-Lenovo-ThinkPad-X1-Carbon-Touch-20A7-002DGE-Ultrabook.113926.0.html\" target=\"_self\" class=\"internal-link\">2nd Gen</a>’s radical (and arguably illogical) keyboard design and polarizing full-depression clickpad scared away many prospective buyers—as such fearlessly progressive and experimental design decisions generally don’t fit well with the business market, where practicality rules supreme. The Gen 3 wholeheartedly acknowledges these complaints and implements a complete reversal of those decisions. As a result, <strong>the keyboard</strong>—immediately familiar and accessible—<strong>is one of the absolute best we have ever used on an Ultrabook</strong>. Meanwhile, the <strong>three classic top-mounted physical buttons for use with the Trackpoint have returned</strong>, and the <strong>touchpad</strong> itself <strong>ditches the controversial full-click design</strong> in favor of a far more comfortable (and, in our judgment, reliable) clickpad approach. The end result is that the X1 Carbon Gen 3 <strong>features some of the best input devices we’ve tested on an Ultrabook</strong>.</p>\n<p class=\"align-justify\">What about performance? <strong>CPU performance differences between the <a href=\"http://www.notebookcheck.net/Review-Update-Lenovo-ThinkPad-X1-Carbon-Touch-20A7-002DGE-Ultrabook.113926.0.html\" target=\"_self\" class=\"internal-link\">2nd Gen</a> and 3rd Gen</strong> X1 Carbon models <strong>were essentially nil</strong> in our testing—for all intents and purposes, the machines are identical in this regard. However in GPU testing, we witnessed a notable speed boost—in some cases up to 19% better. As compared with other modern notebooks of its class, apart from some multi-core synthetic performance hiccups, <strong>the X1 Carbon 3rd Gen holds its own, both in terms of CPU/GPU and general system performance</strong>. The only final niggle here is the Samsung PM851 SSD, whose write speeds are conspicuously capped at around 250 MB/s.</p>\n<p class=\"align-justify\">While the leap to a Broadwell chipset and slightly larger battery seemed sure to promise improved <strong>battery runtimes</strong>, we were surprised to find throughout our testing that <strong>there wasn’t much of a difference at all</strong>. Our classic Wi-Fi Surfing Test produced a result <strong>only slightly better than that of the <a href=\"http://www.notebookcheck.net/Review-Update-Lenovo-ThinkPad-X1-Carbon-Touch-20A7-002DGE-Ultrabook.113926.0.html\" target=\"_self\" class=\"internal-link\">2nd Gen</a></strong>, and the revised Wi-Fi test we just recently implemented—which is more broad and aggressive and arguably closer to actual real-world usage patterns—recorded under five hours before the machine shut down. That’s hardly an impressive number on one hand given the 50 Wh battery and supposed enhanced efficiency, though it’s still likely to get most users through a typical trip unplugged, especially if more restrictive power savings options are employed. If longer battery life is a priority, we’d suggest taking a look instead at the <a href=\"http://www.notebookcheck.net/Dell-XPS-13-9343-Touchscreen-Ultrabook-Review.135817.0.html\" target=\"_self\" class=\"internal-link\">Dell XPS 13-9343</a> or the <a href=\"http://www.notebookcheck.net/Apple-MacBook-Air-13-MD761D-B-2014-06-Notebook-Review-Update.119805.0.html\" target=\"_self\" class=\"internal-link\">MacBook Air 13</a>.</p>\n<p class=\"align-justify\">Rounding out the list of considerations is an <strong>underwhelming screen</strong>, at least in terms of brightness, contrast, and color saturation—though we do most certainly appreciate the <strong>anti-glare display filter</strong> for both its diffusion of reflections and relative ease of cleaning. The X1 Carbon Gen 3 is also <strong>invariably cool and quiet</strong>, clearly favoring comfort over top-end performance (as we discovered during our stress testing of the device).</p>\n<p class=\"align-justify\">Summing up, the X1 Carbon Gen 3 is <strong>indisputably superior to its predecessor</strong>. Although some of these improvements come in the form of better GPU performance, cooler temperatures, and lower average system noise levels, the vast majority of them center on the thankful retreat from the experimental (and finicky) input devices of the Gen 2 design and back to sanity. This isn’t just a return to form, either; to reiterate, by our judgment, they are some of the best input devices on any Ultrabook we’ve tested to date. But in spite of this self-improvement, <strong>how does the X1 Carbon compare with its modern competitors</strong>? In truth, though it’s a compelling option, <strong>it’s lost some ground since our last encounter</strong>. While notebooks such as the <a href=\"http://www.notebookcheck.net/Apple-MacBook-Air-13-MD761D-B-2014-06-Notebook-Review-Update.119805.0.html\" target=\"_self\" class=\"internal-link\">MacBook Air 13</a> and (especially) the <a href=\"http://www.notebookcheck.net/Dell-XPS-13-9343-Touchscreen-Ultrabook-Review.135817.0.html\" target=\"_self\" class=\"internal-link\">Dell XPS 13-9343</a> have sprinted forward with such massive improvements in portability, battery life, and LCD quality, the X1 Carbon 3rd Gen has only marginally improved, mostly regaining footing it’s lost elsewhere. It’s <strong>still a strong contender</strong>, and it’s <strong>certainly the best Carbon to date</strong>, but especially at a <strong>pricey $1,574</strong>, we fear that its inability to innovate further may relegate it to the shadows of these more aggressive contenders.</p>\n",
174 "annotations": [],
175 "mimetype": "text/html",
176 "language": "en",
177 "reading_time": 3,
178 "domain_name": "www.notebookcheck.net",
179 "preview_picture": "http://www.notebookcheck.net/fileadmin/Notebooks/Lenovo/ThinkPad_X1_Carbon_2015/x12015.jpg",
180 "tags": []
181 },
182 {
183 "is_archived": 0,
184 "created_at": "2016-09-08T11:55:58+0200",
185 "updated_at": "2016-09-08T11:57:16+0200",
186 "is_starred": 0,
187 "id": 541,
188 "title": "Visitons le Château de Landsberg !",
189 "url": "http://autour-du-mont-sainte-odile.overblog.com/2016/01/visitons-le-chateau-de-landsberg.html",
190 "content": "<p class=\"c1\">Situé au dessus de Heiligenstein et de Barr, à mi-hauteur de la montée vers plateau de la Bloss, le château de Landsberg est un but de promenade apprécié des randonneurs et des amateurs de vieilles pierres. Posé sur un éperon de granite, visible de loin, la forteresse médiévale domine fièrement la plaine d’Alsace.</p>\n<p class=\"c1\"><img alt=\"Visitons le Château de Landsberg !\" class=\"ob-cell ob-img ob-media c2\" src=\"http://img.over-blog-kiwi.com/0/28/39/78/20160128/ob_e68986_2.jpg\"/></p>\n<h3>Le château primitif</h3>\n<p class=\"c1\">Fin du onzième siècle, <strong><a href=\"http://autour-du-mont-sainte-odile.overblog.com/2014/01/l%E2%80%99assassinat-de-philippe-de-souabe.html\">Philippe de Souabe et Otton de Brunswick</a></strong> se disputent le trône impérial. Philippe, tenant des Hohenstaufen, veut conforter la puissance des couvents du <strong>Mont Sainte Odile.</strong> Il s’appuie sur un de ses représentants pour construire une nouvelle forteresse sur le Mont. <strong>Conrad de Vinhege</strong> érige le château de Landsberg dont sa famille prendra bientôt le nom. Nous sommes en 1197-1198. Le burg est construit sur les terres de l’<strong>abbaye de Niedermunster</strong>, le Couvent du Bas du Mont Sainte Odile. Un acte est signé de l’Abbesse <strong>Edelinde</strong>, il est daté du 23 juin 1200, il confirme la cession du terrain au chevalier Conrad.<br/>Nous avons publié le <a href=\"http://autour-du-mont-sainte-odile.overblog.com/2015/01/edelinde-et-le-chateau-de-landsberg.html\"><strong>texte de l’abbesse Edelinde</strong></a>, l’an passé. (cliquez sur le lien)<br/>Ce premier château n’avait pas l’importance des ruines que nous pouvons admirer aujourd’hui. Il ne comportait qu’un donjon et un corps de logis, complété par une basse-cour. Commençons la visite des ruines par cette partie. Le <strong>donjon</strong> est construit sur un carré de dix mètres de côté. Puissant, placé en diagonale par rapport au corps de logis, il formait bouclier pour défendre celui-ci du côté de la plaine, au nord-est. En levant la tête, le visiteur découvre l’accès : une porte haute, qui était accessible par un pont volant à partir de l’étage du logis seigneurial. Tout en haut du donjon, on distingue encore les corbeaux qui portaient les hourds. Les hourds, constructions de bois, ancêtres des mâchicoulis, permettaient aux défenseurs de surplomber les assaillants du château.<br/><img alt=\"Visitons le Château de Landsberg !\" class=\"ob-cell ob-img ob-media c3\" src=\"http://img.over-blog-kiwi.com/0/28/39/78/20160128/ob_d6d5c7_litho.jpg\"/>Le <strong>logis seigneurial</strong> comportait un rez-de-chaussée dédié à l’usage domestique : cuisines, citerne, salle des gardes. Ces pièces basses n’étaient éclairées que par quelques meurtrières. Le premier étage était l’habitation de Conrad et de ses successeurs : la façade nord-est est largement éclairée par quatre <strong>baies géminées</strong> en plein-cintre. Les fenêtres doubles sont séparées par de fines colonnes et surmontées d’élégants occuli. Au sud-est, deux doubles baies et un <strong>magnifique oriel</strong> agrémentent la façade. Situé sur le coté de la porte du château, cet élément de décor est le plus frappant du site du Landsberg, un genre d’échauguette semi-cylindrique, portée par un cul de lampe conique. Nous serions là dans la chapelle castrale du Landsberg. Coté extérieur, deux petites sculptures ornent la base de l’oriel : une fleur de lys et un petit personnage accroupi. A l’intérieur, une frise d’arceaux délimite les petites fenêtres du chœur de la chapelle. L’une d’elles a la forme d’une croix. Admirez la finesse des dessins du chapiteau de la colonne toujours en place au droite de l’oriel !<br/>Le château de Landsberg est situé à la limite géologique des grès, prédominants au nord, et des granites d’Andlau, côté sud. Les bases et les assises de la forteresse sont en granite, roche dure extraite du fossé creusé au nord, par les carriers du moyen âge. Les parties hautes sont en grès rose du Maennelstein, plus facile à travailler.</p>\n<h3 class=\"c4\">Le château neuf</h3>\n<p class=\"c1\">Ce premier château était, somme toute, de dimensions modestes. Quelques dizaines d’ années plus tard, preuve de l’importance des couvents du Mont Sainte Odile et signe de la puissance croissante de la famille de Landsberg, le site fut agrandi de façon conséquente. Nous sommes alors en 1240-1250.<br/>L’extension se fait au nord-ouest. Les deux tours rondes et l’imposante courtine délimitent l’emprise du Château Neuf. A l’origine, cette nouvelle enceinte était détachée du vieux burg, les deux sites ne furent rattachés que postérieurement. Les <strong>tours circulaires</strong> mesurent environ sept mètres de diamètre. Leur sommet portaient des créneaux. Un <strong>chemin de ronde</strong> surmontait la courtine : il était garni de hourds et traversait les deux tours. Archères et bretèches sont toutes orientées au nord, côté montagne, là où le risque d’attaque était le plus grand.<br/>Deux corps de logis se partageaient le site. Au sud, le bâtiment ne comportait qu’un seul étage, éclairé au sud-ouest par des fenêtres à banquettes, aujourd’hui murées. Le deuxième bâtiment, côté nord, fut construit plus tard. Composé de deux étages, il communiquait directement avec la tour nord.<br/>L’ensemble a connu plusieurs remaniements au cours des siècles.</p>\n<p class=\"c1\"><img alt=\"Visitons le Château de Landsberg !\" class=\"ob-cell ob-img ob-media c5\" src=\"http://img.over-blog-kiwi.com/0/28/39/78/20160128/ob_0861df_11.jpg\"/></p>\n<h3 class=\"c4\">Les extensions du XVème et du XVIème siècles</h3>\n<p class=\"c1\">L’apparition des <strong>armes à feu</strong> modifie l’art de la guerre. La géométrie des châteaux doit s’adapter aux armes nouvelles : résister aux boulets et accueillir couleuvrines et canons. Tous les châteaux des Vosges n’ont pas connu cette évolution, certains, trop solitaires, trop isolés, ont été abandonnés dés cette époque. Au Landsberg, les seigneurs ont respecté le vieux burg dans sa forme initiale, mais ils l’ont adapté tout d’abord en renforçant ses murs, puis en l’entourant de nouvelles murailles. Au nord, le château neuf se voit délaissé, ses nombreuses ouvertures extérieures sont murées, à part les archères, bien entendu. Ses courtines sont prolongées pour assurer la continuité avec celles du vieux burg. Un <strong>puissant bastion</strong> est construit au sud-est. Les armes nouvelles sont mises en place : couleuvrines, poivrière portant une canonnière protégée par des vastes vantaux. Ainsi, un vaste glacis s’étend devant la forteresse. C’est en faisant le tour du château dans les fossés que le promeneur se rendra le mieux compte de la force de la place et de son adaptation aux débuts de l’artillerie.<br/><img alt=\"Visitons le Château de Landsberg !\" class=\"ob-cell ob-img ob-media c6\" src=\"http://img.over-blog-kiwi.com/0/28/39/78/20160128/ob_57b020_plan-schematique.png\"/>Quelques temps, le château est passé des Landsberg au Comte Palatin, avant de revenir à la famille qui resta maître des lieux jusqu’à la Révolution.<br/>On ne trouve guère de textes relatant l’histoire du château de Landsberg dans les temps troublés que connut l’Alsace. Lors de la <strong>Guerre du Bundschuh</strong>, les paysans révoltés s’étaient installés dans la prévôté de Truttenhausen, toute proche. Cependant, rien ne dit que les Rustauds aient attaqué le château. Lors de la <strong>Guerre de Trente Ans</strong>, il semble que les troupes de Mansfeld, puis les Suédois se soient plutôt attaqués aux riches villes de la plaine, comme Obernai, oubliant les forteresses de montagne, déjà devenues inutiles. Cependant, le château est décrit comme ruiné au milieu du XVIIème siècle.<br/>Depuis longtemps, les Landsberg avaient délaissé le burg de leurs ancêtres pour lui préférer leur <strong>résidence de Niedernai</strong>, située en plaine. Le château fut confié à des gardes, puis servit de ferme. Aujourd’hui, les ruines du Landsberg sont une propriété privée. Merci à vous de respecter le site.</p>\n<p class=\"c1\">Dans la basse cour du château fleurit au printemps, l’<strong>éranthe d’hiver</strong>. Sa floraison ne dure que quelques jours. Cette petite fleur jaune est rare sous nos climats. De son nom latin ‘Eranthis hyemalis’, l’éranthe est originaire d’Italie ou de Turquie. La légende nous dit qu’elle aurait été rapportée des croisades par un sire de Landsberg. Elle serait un remède à la mélancolie.</p>\n<h3 class=\"c4\">Promenade et accès au château de Landsberg<img alt=\"Visitons le Château de Landsberg !\" class=\"ob-cell ob-img ob-media c7\" src=\"http://img.over-blog-kiwi.com/0/28/39/78/20160128/ob_902c3e_org.jpg\"/></h3>\n<p class=\"c1\">Les automobilistes pourront garer leur véhicule sur le petit parking situé à l’ouest d’Heiligenstein. Ils gagneront Truttenhausen sur la petite route à travers prés. Un sentier du Club Vosgien ( disque bleu ) monte vers les ruines.<br/>Les marcheurs préfèreront effectuer une boucle à partir de Saint-Jacques, par exemple. Saint-Jacques, Kapellenhausfelsen, Ameisenberg, Landsberg ( balisage : triangle bleu ) avec un retour sur Saint-Jacques par le sentier sans dénivelé ( rectangle : bicolore rouge et blanc).<br/>A moins qu’ils ne préfèrent rechercher les pierres sculptées du <a href=\"http://autour-du-mont-sainte-odile.overblog.com/des-chameaux-en-alsace\"><strong>Chemin des Chameaux</strong></a>. (cliquez sur le lien ), ou découvrir la <a href=\"http://autour-du-mont-sainte-odile.overblog.com/2015/07/la-chapelle-de-frere-leon-pres-de-barr.html\"><strong>Chapelle du Frère Léon</strong></a> dans la vallée de la Kirneck.</p>\n<h3 class=\"c4\">Illustrations</h3>\n<ul><li class=\"c8\">Photographies du château de Landsberg ( BrR, FrP et PiP)</li>\n<li class=\"c8\">Schéma des ruines ( PiP)</li>\n<li class=\"c8\">L’Orgueil, Herrade de landsberg, Hortus Deliciarum</li>\n<li class=\"c8\">Les Ruines du Landsberg, aquarelle de Osterwald, 1873</li>\n</ul>\n",
191 "annotations": [],
192 "mimetype": "text/html",
193 "language": "fr",
194 "reading_time": 7,
195 "domain_name": "autour-du-mont-sainte-odile.overblog.com",
196 "preview_picture": "http://img.over-blog-kiwi.com/0/28/39/78/20160128/ob_68f59d_12.jpg",
197 "tags": []
198 },
199 {
200 "is_archived": 1,
201 "created_at": "2016-09-08T11:55:58+0200",
202 "updated_at": "2016-09-08T11:57:16+0200",
203 "is_starred": 0,
204 "id": 454,
205 "title": "Contrer les stéréotypes par les livres : “C'est dès l'enfance qu'ils se construisent”",
206 "url": "https://www.actualitte.com/article/monde-edition/contrer-les-stereotypes-par-les-livres-c-est-des-l-enfance-qu-ils-se-construisent/64058",
207 "content": "<br/><h2><strong>Même dans l'espace jeunesse d'un immense salon littéraire, difficile de passer à côté du livre de coloriage féministe — et fier de l'être — de la maison d'édition Goater. Cette structure atypique, adossée à un bar de Rennes, Le Papier-Timbré, propose des titres tout aussi uniques, de ces livres que l'on devine importants avant même de les ouvrir. </strong></h2>\n\n<p class=\"c3\"><img alt=\"Livre Paris 2016\" src=\"https://farm2.staticflickr.com/1650/25284788384_ea234db7b9_z.jpg\" class=\"c2\"/></p>\n<p class=\"c3\">Judikael et Jean-Marie Goater (ActuaLitté, CC BY SA 2.0)</p>\n\n\n<p class=\"p1\">Le Papier-Timbré et les éditions Goater avancent main dans la main, dans une même structure, depuis 2009. En plus de la licence IV, permis de publier : « <em>On est très occupé par les soirées étudiantes et festives, mais on développe en plus des projets autour des livres qui, parfois, émergent d'ailleurs avec la clientèle. C'est surtout un motif supplémentaire pour se retrouver et partager des moments de convivialité, partager des goûts, des envies, de la littérature, des essais et de la jeunesse</em> », explique Jean-Marie Goater.</p>\n<p class=\"p1\"> </p>\n<p class=\"p1\">En plus de la production maison, le café-librairie propose celle de maisons soeurs : les éditions de juillet, L'Oeuf, les Éditions Pontcerq, essentiellement des petits éditeurs de Rennes et de la Bretagne. La maison est diffusée et distribuée en Bretagne par Coop Breizh, diffusé par Hobo Diffusion, distribué par Makassar pour la France (comme <a href=\"https://www.actualitte.com/article/monde-edition/avec-les-editions-prairial-le-surrealisme-nrv-est-de-retour/64055\">les éditions surréalistes Prairial</a>). Les tirages vont de 500 exemplaires à 3000 sauf exceptions et coéditions comme <em>Détachez vos ceintures</em>, projet collectif des éditions du Kyste contre l'aéroport de Notre-Dame-des-Landes, ou <em>Galette-saucisse, je t’aime !</em> de Benjamin Keltz, avec les Éditions du coin de la rue.</p>\n<p class=\"p1\"> </p>\n<p class=\"p1\"><em>Mon premier cahier de coloriage féministe !</em> sera en librairie d'ici quelques jours, et la maison Goater y croit dur comme fer : « <em>Nous avons commencé par traduire et adapter</em> C'est quoi ton genre ?<em>, un livre écrit par Jacinta Bunnell et publié par l'éditeur anarchiste américain PM Press</em> », explique Jean-Marie Goater. Dans les pages du livre, on croise des monstres qui aiment les petits sacs à main et les chaussures, des princesses qui ne suivent pas vraiment le dress code, ou des enfants en fauteuil roulant, encore rares dans les livres jeunesse.</p>\n<p class=\"p1\"> </p>\n<p class=\"p1 c3\"><img alt=\"Livre Paris 2016\" src=\"https://farm2.staticflickr.com/1628/25822534701_142d157b15_z.jpg\" class=\"c2\"/></p>\n<p class=\"p1 c3\">(ActuaLitté, CC BY SA 2.0)</p>\n<p class=\"p1 c3\"> </p>\n<p class=\"p1\"> </p>\n<p class=\"p1\">Après cette publication, la maison a souhaité développer un projet en France, en réunissant 16 dessinatrices dont 4 dessinateurs pour leur proposer d'expliquer le féminisme aux enfants, à travers un dessin. « <em>Le livre aborde la vie à l'école, les habillements, les métiers, le sport, mais aussi les quelques femmes féministes importantes de l'histoire... Ça reste ludique et sans prétention encyclopédique sur le féminisme, mais il est plus simple d'aborder le sujet avec un support comme celui-ci à la maison, à l'école ou au centre de loisirs.</em> » Comme le précédent, l'ouvrage présente d'une nouvelle manière les situations traditionnelles des livres de coloriage ou jeunesse.</p>\n<p class=\"p1\"> </p>\n<h3 class=\"p1\"><strong>Des ressources rares, des besoins importants</strong></h3>\n<p class=\"p1\"> </p>\n<p class=\"p1\">Pas la peine d'insister pour que Jean-Marie Goater partage son avis : « <em>La production majoritaire est quand même très caricaturale et stéréotypée, cependant on remarque depuis quelques années des éditeurs intéressants qui essaient de bousculer un peu ces stéréotypes comme La Ville Brûle, ou encore l'édition LGBT qui commence à arriver avec Des ailes sur un tracteur qui a publié un cahier de coloriage avec Sophie Labelle, plutôt sur les questions trans.</em> »</p>\n<p class=\"p1\"> </p>\n<p class=\"p1\">Contrairement à ce que les détracteurs des livres jeunesse atypiques prétendent (<a href=\"https://www.actualitte.com/recherche?q=tous+a+poil+cope\">coucou, Jean-François Copé</a>), lutter contre les stéréotypes n'a rien d'une guerre de civilisation ou autre affabulation du genre. Il s'agit simplement de montrer que chacun doit être fier de ce qu'il est, respecter ce que l'autre est, et ne pas chercher l'assentiment des uns ou des autres. « <em>Fuck the world</em> », comme dirait 2Pac... « <em>Se poser ces questions est indispensable, il faut qu'il y ait ce débat : les enfants ne sont pas si naïfs que ça, ils ont besoin de se poser ce genre de questions.</em> »</p>\n<p class=\"p1\"> </p>\n<p class=\"p1 c3\"><img alt=\"Livre Paris 2016\" src=\"https://farm2.staticflickr.com/1554/25284764604_1d8b3e9a0a_z.jpg\" class=\"c2\"/></p>\n<p class=\"p1 c3\">(ActuaLitté, CC BY SA 2.0)</p>\n<p class=\"p1\"> </p>\n<p class=\"p1\"> </p>\n<p class=\"p1\">Judikael, venu aider son père, acquiesce : il a répondu à l'appel à dessins et proposé une activité dans le cahier de coloriage féministe. « <em>Ce genre de ressources pour enfant est important, parce que c'est dès l'enfance que se construisent certains préjugés, certains stéréotypes qui restent ensuite. Quand on voit que 90 % des personnes présentes dans les manuels scolaires sont des hommes par exemple, ce genre d'ouvrages permet à certaines personnes de se reconnaître davantage dans certains rôles, qu'on ne leur attribue pas forcément de base.</em> »</p>\n<p class=\"p1\"> </p>\n<p class=\"p1\">Là est la lutte, résumée par Judikael : « <em>On parle souvent de</em> “déconstruire” <em>dans le féminisme, les préjugés ou autre, ces livres peuvent permettre d'éviter de les construire.</em> » En Terminale L, Judikael confirme que les préjugés sont toujours présents, forcément surtout en sport ou vis-à-vis de « <em>la filière homme</em> » (comprendre, la filière scientifique) et de « <em>la filière femme </em>» (comprendre, la filière littéraire). Si l'histoire du féminisme est désormais abordée en classe, certains sujets restent touchy : le journal du lycée s'est vu censurer un article sur la culture du viol, et la ségrégation hommes-femmes, « <em>au prétexte que c'était trop hard, que les lycéens n'allaient pas comprendre </em>»...</p>\n<p class=\"p1\"> </p>\n<h3 class=\"p1\"><strong>« <em>L'édition, c'est un milieu qui est quand même très hypocrite</em> »</strong></h3>\n<p class=\"p1\"> </p>\n<p class=\"p1\">À votre avis, comment réagit l'éditeur de <em>Mon premier cahier de coloriage féministe</em> lorsqu'on lui parle des différences entre les salaires <a href=\"https://www.actualitte.com/article/monde-edition/l-inegalite-entre-hommes-et-femmes-persiste-dans-le-monde-du-livre/63891\">des hommes et des femmes dans l'édition</a>, ou dans les aides attribuées par le CNL ? Sans langue de bois : « <em>C'est pas trop surprenant malheureusement, parce que c'est à l'image des autres professions. En tant que bar-maison d'édition, de toute façon, je ne rentre pas dans la case du CNL, je me tourne plutôt vers la région</em> », explique Jean-Marie Goater.</p>\n<p class=\"p1\"> </p>\n<p class=\"p1\">Haut les coeurs : « <em>C'est pas grave, je m'en passe très bien. L'édition, c'est un milieu qui a quand même une grande dimension d'hypocrisie sur pas mal d'aspects, on le voit sur certaines pratiques... Il y a des cons dans ce métier-là comme dans d'autres métiers, mais je pense que ce serait bien de faire le ménage, comme à Angoulême, c'est quand même criant. Dans certains secteurs du livre, la majorité des lecteurs sont des lectrices, très clairement, ce serait quand même la moindre des choses qu'il n'y ait pas des inégalités de ce type qui existent dans le monde de l'édition.</em> »</p>\n<p class=\"p1\"> </p>\n<p class=\"p1 c3\"><img alt=\"Livre Paris 2016\" src=\"https://farm2.staticflickr.com/1672/25796714772_315ae8c648_z.jpg\" class=\"c2\"/></p>\n<p class=\"p1 c3\">Un album jeunesse bilingue français-langue des signes (ActuaLitté, CC BY SA 2.0)</p>\n<p class=\"p1\"> </p>\n<p class=\"p1\"> </p>\n<p class=\"p1\">Même sans aide du CNL, les éditions Goater produisent de quoi lire : <em>Les Joyeux Punks</em>, un album à compter, mais aussi une collection d'albums bilingues français-langue des signes, des livres en breton, dont une traduction du <em>Persepolis</em> de Marjane Satrapi. Pour les amateurs de polar, Goater noir, une collection de 14 titres qui a notamment fait revivre <em>Le Soviet</em>, la série culte des années 89-90 d'abord publiée chez Fleuve Noir et Série Noire. Pour les amateurs des écrits du Colonel Durruti, un inédit est prévu pour le mois d'octobre prochain.</p>\n<p class=\"p1\"> </p>\n<p class=\"p1\">Perdez-vous sans hésiter dans le catalogue de la maison, qui propose aussi de la littérature blanche \"classique\", des essais sur l'écologie et le convivialisme ou la convivialité, l'écologie sociale, et l'Histoire, surtout XXe.</p>\n\n<br/>",
208 "annotations": [],
209 "mimetype": "text/html",
210 "language": "en",
211 "reading_time": 6,
212 "domain_name": "www.actualitte.com",
213 "preview_picture": "//cdn.actualitte.com/images/facebook/25284788384-ea234db7b9-z-56eeff88c23a0.jpg",
214 "tags": []
215 },
216 {
217 "is_archived": 1,
218 "created_at": "2016-09-08T11:55:58+0200",
219 "updated_at": "2016-09-08T11:57:16+0200",
220 "is_starred": 0,
221 "id": 99,
222 "title": "[ROM][6.0.1][Layers][N5] TipsyOS official builds {UBER TCs}",
223 "url": "http://forum.xda-developers.com/google-nexus-5/development/rom-tipsyos-official-builds-uber-tcs-t3325989",
224 "content": "<div class=\"post-text post-first-post\" id=\"post_message_65589573\" readability=\"82\">\n<div class=\"c16\" readability=\"51\"><img src=\"http://imagizer.imageshack.us/v2/640x480q90/673/zEwXs9.png\" border=\"0\" alt=\"\" title=\"\"/><p><span>*Welcome to Tipsy OS*</span></p>\n<div class=\"c16\"><img src=\"http://imagizer.imageshack.us/v2/1024x768q90/922/uy7Jf6.png\" border=\"0\" alt=\"\" title=\"\"/></div>\n<br/><span>This is something Martin Coulon (@martinusbe) started in his 'free' time when waiting for GZR Validus or Tesla builds and having some drinks.<br/>He just started with a slim base; on lp and early mm, and now using <a href=\"https://github.com/AOSPB\" target=\"_blank\" rel=\"nofollow\"><strong class=\"c17\"><span>AOSPB</span></strong></a> as a base (wich Martin is also a part of)....then added what we thought useful.<br/>It grew up to be a fully functional Rom<br/>The main goal is to keep it AOSPB/Slim based and will not add any cm features unless AOSPB/Slim does.<br/></span>\n<p>TipsyOS is Black and Yellow default themed, we don't like white UI, so it may look a bit weird on light switch,<br/>but heh! use layers to suit it your needs =)</p>\n<p>We are a team wich is constantly learning and ...drinking because both gets along so well hahaha <img src=\"http://forum.xda-cdn.com/images/smilies/laugh.gif\" border=\"0\" alt=\"\" title=\"Laugh\" class=\"inlineimg\"/></p>\n<p>Just report the bugs and request features, we'll see what we can do!.......</p>\n<p><strong>And don't get it twisted</strong>, its not because we're Tipsy that this project is not a serious one, try it and feel speed and stability <img src=\"http://forum.xda-cdn.com/images/smilies/tongue.gif\" border=\"0\" alt=\"\" title=\"Stick Out Tongue\" class=\"inlineimg\"/></p>\n<p>My builds are compiled with UBER toolchains 4.9 on both rom and kernel code.<br/>We can go over with 5.2/3, 6 ...but to be really honest, 4.9 is the most battery friendly in my opinion, and is still super smooth and snappy!</p>\n<p>Im using a cm device tree base a bit modified...<br/>This rom includes a custom kernel, cm was my base, and i have decided to go a bit wild and cherry-picked up <em>some</em> stuff from:<br/>Francisco Franco, Chet Kener, Faux123, Flar2, Hellsgod and some others<br/>So a <strong class=\"c17\">huge thanks</strong> for them and their AWESOME open sources work!<br/>I will continue to work on this kernel because its fun <img src=\"http://forum.xda-cdn.com/images/smilies/laugh.gif\" border=\"0\" alt=\"\" title=\"Laugh\" class=\"inlineimg\"/></p>\n<div class=\"c16\" readability=\"8\"><img src=\"http://imagizer.imageshack.us/v2/1024x768q90/923/nPeHiF.png\" border=\"0\" alt=\"\" title=\"\"/><p><strong><em><span>For cool wallpapers, test builds, requests; join us on our community!</span></em></strong></p>\n</div>\n<strong class=\"c17\"><span><a href=\"https://plus.google.com/u/0/communities/114022867167626892613\" target=\"_blank\" rel=\"nofollow\"><span>Google+ Community</span></a></span></strong>\n<div class=\"c16\"><strong class=\"c17\"><span>Features:</span></strong>\n<div class=\"c20\">\n<p>Code:</p>\n<pre class=\"alt2 c19\" dir=\"ltr\">\nWe slowly adding only what we need, we don't want a 1236544547 features rom...\n\"The Tavern\":\nPower menu customisations\nToasts/ListView/System animations\nBattery bar\nLCD Density\nGesture Anywhere\nExpanded Desktop\nStatus bar customisations\nAosp Recents and OmniSwitch \nBuilt in:\nDashboard (settings) columns selector\nDashboard lines remover\nSlim Navbar customisation\nVolume steps\nNotification led changer\nHeadsUp switch\nKernel Adiutor app\nLayers manager app\nLayers backup/restore app\nAdaway\nNova launcher\nViper4Android\nES Manager\nSnapCam\nChangelog generator in about phone menu....\nand prolly some other stuff that i can't remember but heh,\n just flash dat sh#t to figure out by yourself =)\n</pre></div>\n</div>\n<p><span><br/><span class=\"c12\">Installation Instructions</span><br/></span></p>\n<p><span>1. Make sure you have a working recovery and a nandroid backup</span></p>\n<p><span>2. Download the ROM.</span></p>\n<p><span>3. Reboot to recovery.</span></p>\n<p><span>4.Wipe everything! system/data/cache partitions (except internal storage indeed!)</span></p>\n<p><span>7. Flash the ROM.</span></p>\n<p><span><em>Optional- Flash 6.x GApps.</em></span></p>\n<p><span>8. Reboot and feel Tipsy!</span></p>\n<p><strong class=\"c17\"><span>Download:</span></strong></p>\n<p><span><a href=\"https://www.androidfilehost.com/?w=files&amp;flid=48392\" target=\"_blank\" rel=\"nofollow\"><strong class=\"c17\"><span>Tipsy HammerHead downloads folder</span></strong></a></span></p>\n<p><span>STAY TIPSY <img src=\"http://forum.xda-cdn.com/images/smilies/wink.gif\" border=\"0\" alt=\"\" title=\"Wink\" class=\"inlineimg\"/><img src=\"http://forum.xda-cdn.com/images/smilies/laugh.gif\" border=\"0\" alt=\"\" title=\"Laugh\" class=\"inlineimg\"/></span><br/><img src=\"http://imageshack.com/a/img924/6871/q1zjrl.gif\" border=\"0\" alt=\"\" title=\"\"/></p>\n<p><span><strong>TipsyOs, a ROM for Nexus 5 aka Hammerhead</strong></span></p>\n</div>\n<br/><strong class=\"c17\"><span>Kernel features:</span></strong><br/>Kexec patch for multirom support, intelliplug, hellsactive governor, extra io schedulers, intellithermal v2, etc etc and growing, just check commits on history on the link below\n<p><strong class=\"c17\"><span>Known bugs:</span></strong><br/>quick tiles may be a bit messy while re arranging them....<br/>u tell me then.</p>\n<p><span>don't even think to report a bug with:</span><br/>a dirty flashed rom,<br/>xposed frameworks installed,<br/>all of your apps installed, if u have a bug, clean flash the build, (flash the gapps if needed) and reproduce your bug without any data restore.<br/>BRING BACK LOGCAT or u will be simply ignored....</p>\n<p><strong class=\"c17\">Contributors</strong><br/><a href=\"http://forum.xda-developers.com/member.php?u=4139665\" target=\"_blank\">martinusbe</a><br/>@<a href=\"http://forum.xda-developers.com/member.php?u=5265704\" target=\"_blank\">Alx31</a><br/><strong>ROM OS Version:</strong> 6.0.1 Marshmallow<br/><strong>ROM Kernel:</strong> Linux 3.4.x<br/><strong>Based On:</strong> AOSPB</p>\n<p><strong class=\"c17\">Version Information</strong><br/><strong>Status:</strong> Stable<br/><strong>Created</strong> 2016_29_02</p>\n<p><strong class=\"c17\">Credits:</strong><br/>AOSPB/Slim team for an amazing base, Google, CyanogenMod for device trees and some other repos, Dirty Unicorns/CrDroid/AICP and other roms with their open sources i may have forgotten...</p>\n<p><strong class=\"c17\">Rom code:</strong> <a class=\"c21\" href=\"https://github.com/TipsyOs\" target=\"_blank\" rel=\"nofollow\">https://github.com/TipsyOs</a><br/><strong class=\"c17\">Device:</strong> <a class=\"c21\" href=\"https://github.com/TipsyOs-Devices/device_lge_hammerhead/commits/6.0\" target=\"_blank\" rel=\"nofollow\">Hammerhead commits history</a><br/><strong class=\"c17\">Kernel code:</strong> <a class=\"c21\" href=\"https://github.com/TipsyOs-Devices/kernel_lge_hammerhead/commits/6.0\" target=\"_blank\" rel=\"nofollow\">Kernel commits history</a><br/><strong class=\"c17\">My github:</strong> <a class=\"c21\" href=\"https://github.com/Alx31\" target=\"_blank\" rel=\"nofollow\">https://github.com/Alx31</a></p>\n<p><img src=\"http://imagizer.imageshack.us/v2/640x480q90/901/JGwVTy.png\" border=\"0\" alt=\"\" title=\"\"/></p>\n</div><p>Last edited by Alx31; 29th February 2016 at 10:48 PM.</p>",
225 "annotations": [],
226 "mimetype": "text/html",
227 "language": "en",
228 "reading_time": 3,
229 "domain_name": "forum.xda-developers.com",
230 "preview_picture": "http://cdn3.xda-developers.com/images/xda-facebook-default.jpg",
231 "tags": []
232 },
233 {
234 "is_archived": 0,
235 "created_at": "2016-09-08T11:55:58+0200",
236 "updated_at": "2016-09-08T11:57:16+0200",
237 "is_starred": 0,
238 "id": 98,
239 "title": "Top 15 Podcasts All Web Developers Should Follow - Envato Tuts+ Code Article",
240 "url": "http://code.tutsplus.com/articles/top-15-podcasts-all-web-developers-should-follow--net-14461",
241 "content": "<p>As web developers, we’re always trying to get better at what we do. One of the best ways to do that is to listen to what other developers have to share. And even if you’re not learning, it’s still fun to hear what other devs are talking about. Today, I’ll share 15 podcasts that you should definitely check out.</p>\n<hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/yahootheater.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/yahootheater.png\"/></div>\n<p>It seems that as often as a few times a month, Yahoo! brings in developers on the cutting edge of web technology to keep their employees up to date. For the benefit of the rest of us, these talks are recorded and published. You’ll find well-known devs like Douglas Crockford and NNicolas Zakas, and talks on everything from performance and accessibility to JavaScript and the DOM.</p>\n<ul><li><a href=\"http://itunes.apple.com/us/podcast/yui-theater/id263846173\">iTunes Feed</a></li>\n<li><a href=\"http://feeds.yuiblog.com/yuiblog/yui-theater\">RSS Feed</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/devshow.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/devshow.png\"/></div>\n<p>This may be my favourite show from this list. The Dev Show, hosted weekly by Dan Benjamin and Jason Seifer, will give you a carefully curated set of development-related links (usually with a web dev slant) to enjoy. As an added bonus, you can <a href=\"http://live.5by5.tv\">watch the show live</a> on Tuesdays at 1pm EST.</p>\n<ul><li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=352611845\">iTunes Feed (Audio)</a></li>\n<li><a href=\"http://feeds.feedburner.com/thedevshow\">RSS Feed (Audio)</a></li>\n<li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=374004076\">iTunes Feed (Video)</a></li>\n<li><a href=\"http://feeds.feedburner.com/devshowvideo\">RSS Feed (Video)</a></li>\n<li><a href=\"http://twitter.com/devshow\">Twitter</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/changelog.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/changelog.png\"/></div>\n<p>The tagline for the Changelog says it all: “Open Source moves fast. Keep up.” This podcast, and the accompanying blog, is all about keeping you updated with the latest in Open Source Technology. It’s hosted by Adam Stacoviak and Wynn Netherland, and seems to be the official Github podcast.</p>\n<ul><li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=341623264&amp;subMediaType=Audio\">iTunes Feed</a></li>\n<li><a href=\"http://feeds.feedburner.com/thechangelog\">RSS Feed</a></li>\n<li><a href=\"http://twitter.com/changelogshow\">Twitter</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/jquerypodcast.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/jquerypodcast.png\"/></div>\n<p>If you’re familiar with jQuery (and you probably are), you know there’s a podcast to go with it. Each week, hosts Ralph Whitbeck and Rey Bango bring you the latest in jQuery news, as well as great interviews with important people in the jQuery community. You can listen in to the jQuery wisdom of people like Remy Sharp, Yehuda Katz, Cody Lindley, and our own Jeffrey Way, among so many others.</p>\n<ul><li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=339835419\">iTunes Feed</a></li>\n<li><a href=\"http://feeds.feedburner.com/jQueryPodcastShowNotes\">RSS Feed</a></li>\n<li><a href=\"http://www.twitter.com/jquerypodcast\">Twitter</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/sitepoint.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/sitepoint.png\"/></div>\n<p>Sitepoint is a great resource for anyone interesting in technology, design, and even business. Books, courses, forums, blogs, articles, they’ve got it all. Of course, there’s a podcast too: check it out to find out what’s going on in the web industry.</p>\n<ul><li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=296180681&amp;s=143441\">iTunes Feed</a></li>\n<li><a href=\"http://www.sitepoint.com/blogs/?feed=podcast\">RSS Feed</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/webpulp.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/webpulp.png\"/></div>\n<p>According to the site, WebPulp is “a podcast about technology that powers the web.” In each podcast, host Josh Owens interviews someone from behind the scenes of a well-known webapp; you’ll find out what hardware and software it takes to run apps like the 37signals apps, or GitHub.</p>\n<ul><li><a href=\"http://itunes.apple.com/us/podcast/webpulp-tv/id371328694\">iTunes Feed</a></li>\n<li><a href=\"http://webpulp.tv/rss\">RSS Feed</a></li>\n<li><a href=\"http://twitter.com/webpulptv\">Twitter</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/wordpresspodcast.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/wordpresspodcast.png\"/></div>\n<p>It’s pretty apparent that both Nettuts+ readers and writers are big fans of WordPress. If you can’t get enough WordPress goodness, you’ll probably want to sign up for the WordPress Podcast, “a weekly podcast with news, interviews and plugin tips.” There’s a bonus here: one of the most recent interviewees was none other than Collis Ta’eed, CEO of Envato.</p>\n<ul><li><a href=\"http://itunes.apple.com/us/podcast/wordpress-community-podcast/id164651619\">iTunes Feed</a></li>\n<li><a href=\"http://wp-community.org/feed/\">RSS Feed</a></li>\n<li><a href=\"http://twitter.com/wppodcast\">Twitter</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/eepodcast.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/eepodcast.png\"/></div>\n<p>If you’re a user of Ellis Lab’s Expression Engine, you’ll enjoy the EE Podcast (Ellis Lab is the company behind CodeIgniter; in fact, EE is build completely on CI). Each week, Ryan Irelan and Lea Alcantara will fill in you on a certain aspect of of EE deveopment.</p>\n<ul><li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=334063423\">iTunes Feed</a></li>\n<li><a href=\"http://feeds.feedburner.com/eepodcast\">RSS Feed</a></li>\n<li><a href=\"http://twitter.com/eepodcast\">Twitter</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/csstricks.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/csstricks.png\"/></div>\n<p>If you’re a web developer, you’re probably pretty familiar with Chris Coyier’s website <a href=\"http://www.css-tricks.com\">CSS Tricks</a>. Besides his excellent articles, Chris occasionally puts out a screencast every few weeks. With his relaxed style, you’ll learn about a random—but always practical—part of web development in each episode.</p>\n<ul><li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=273881728\">iTunes Feed</a></li>\n<li><a href=\"http://feeds.feedburner.com/CSS-Tricks-Screencasts\">RSS Feed</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/bigwebshow.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/bigwebshow.png\"/></div>\n<p>Hosted by Jeffrey Zeldman and Dan Benjamin, the Big Web Show “features special guests and topics like web publishing, art direction, content strategy, typography, web technology, and more. It’s everything web that matters.” You’ll listen to interviews in which famous web personalities like Eric Meyer, Jason Fried, Nicole Sullivan, Ethan Marcotte, and other professionals you should know open their minds and let you learn from the best. You can <a href=\"http://5by5.tv/bigwebshow\">catch this show live</a> on Thursdays a 1PM EST. Just like the Dev Show and the EE Podcast, the Big Web Show is part of Dan Benjamin’s incredible <a href=\"http://5by5.tv\">5by5 podcast network</a>.</p>\n<ul><li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=370445683\">iTunes Feed (Audio)</a></li>\n<li><a href=\"http://feeds.feedburner.com/bigwebshow\">RSS Feed (Audio)</a></li>\n<li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=374004085\">iTunes Feed (Video)</a></li>\n<li><a href=\"http://feeds.feedburner.com/bigwebshowvideo\">RSS Feed (Video)</a></li>\n<li><a href=\"http://twitter.com/bigwebshow\">Twitter</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/thinkvitamin.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/thinkvitamin.png\"/></div>\n<p>You may be familiar with Carsonified, the company behind many web dev / design training initiatives (including the Future of Web Design and Future of Web Apps confernces). On Think Vitamin, Carsonified’s “blog about the web”, you can catch Think Vitamin Radio, “a bi-weekly chat about web design, development, and entrepreneurship.”</p>\n<ul><li><a href=\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=351340191\">iTunes Feed</a></li>\n<li><a href=\"http://feeds.feedburner.com/thinkvitaminradio\">RSS Feed</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/userability.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/userability.png\"/></div>\n<p>User Interface Engineering “is a leading research, training, and consulting firm specializing in web site and product usability.” You can take advantage of some of the free usability training they offer in their podcast, the Userability Podcast.</p>\n<ul><li><a href=\"http://itunes.apple.com/podcast/uie-brain-sparks/id119728465\">iTunes Feed</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/jqueryfordesigners.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/jqueryfordesigners.png\"/></div>\n<p>This is a great resource for any beginner (and even intermediate) jQuery developers. In each episode, Remy Sharp will explain how to create an popular web effect using jQuery. You’ll learn how to build pop-up bubbles, sliding headers, and simple tabs.</p>\n<ul><li><a href=\"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=281057468\">iTunes Feed</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/nettuts.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/nettuts.png\"/></div>\n<p>Of course, Nettuts+ publishes screencasts, too! For your convenience, you can get these in an iTunes feed, or subscribe to them on YouTube.</p>\n<ul><li><a href=\"http://itunes.apple.com/podcast/nettuts/id291173544?i=60856588\">iTunes Feed</a></li>\n<li><a href=\"http://www.youtube.com/user/nettutsplus\">Youtube Profile</a></li>\n</ul><hr/>\n<div class=\"tutorial_image\"><img src=\"https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/huffduffer.png\" data-original-url=\"http://nettuts.s3.amazonaws.com/793_podcasts/huffduffer.png\"/></div>\n<p>HuffDuffer is a site created by Jeremy Keith; it allows you to easily create your own podcasts. From the tag cloud above, you can see that a lot of the content being collected is related to web development. Check it out!</p>\n<hr/>\n<p>I’m sure most developers listen to the occasional podcast. Have I missed your favourite podcast? Let us all know in the comments!</p>\n",
242 "annotations": [],
243 "mimetype": "text/html",
244 "reading_time": 4,
245 "domain_name": "code.tutsplus.com",
246 "preview_picture": "https://cdn.tutsplus.com/net/uploads/legacy/793_podcasts/preview.jpg",
247 "tags": []
248 },
249 {
250 "is_archived": 1,
251 "created_at": "2016-09-08T11:55:58+0200",
252 "updated_at": "2016-09-08T11:57:16+0200",
253 "is_starred": 0,
254 "id": 97,
255 "title": "University of Mississippi",
256 "url": "http://olemiss.edu",
257 "content": "<header readability=\"1\">\n<section class=\"hero\">\n</section></header><div class=\"pushdown\">\n<div id=\"academics-push\" class=\"push main c2\" readability=\"21\">\n<hr/><h4>UNIVERSITY OF MISSISSIPPI SCHOOLS AND COLLEGES</h4>\n<hr/><p>The Schools of Nursing and Pharmacy operate on both the Oxford and Jackson campuses. The Schools of Dentistry, Health Related Professionals and Medicine, and the Health Sciences Graduate School, are based in Jackson only. (Additional healthcare programs are available through the School of Applied Sciences on the Oxford campus.) Other than these exceptions, the schools above are on the Oxford campus.</p>\n</div>\n</div>\n<section id=\"herophoto\" readability=\"3\"><p><a href=\"http://www.olemiss.edu/emergency/\"><strong>Public Service Announcement</strong>: UM Health Center Seeing Increase in Flu Cases MORE INFO</a></p>\n<div class=\"flexslider page\">\n<ul class=\"slides\"><li class=\"quad3\">\n<figure><img alt=\"\" src=\"http://olemiss.edu/www.olemiss.edu/_images/hero2/2016-03-02_20_23_23CTG_0268-AC.jpg\"/><figcaption readability=\"2\"><h5>Hotty Toddy</h5>\n<p>Martavious Newby celebrates with fans after Ole Miss' 86-78 win over Mississippi State.</p>\n</figcaption></figure></li>\n<li class=\"quad3\">\n<figure><img alt=\"\" src=\"http://olemiss.edu/www.olemiss.edu/_images/hero2/2016-03-02_20_23_23CTG_0268-AB.jpg\"/><figcaption readability=\"6\"><h5>Moody's Amazing Night</h5>\n<p>Stefan Moody celebrates at the end of Ole Miss' 86-78 win over Mississippi State. Moody finished his final game at The Pavilion on Senior Night with a career-high 43 points.</p>\n</figcaption></figure></li>\n<li class=\"quad2\">\n<figure><img alt=\"\" src=\"http://olemiss.edu/www.olemiss.edu/_images/hero2/2016-03-01_16_29_53CTG_0266-D.jpg\"/><figcaption readability=\"4\"><h5>Career Expo</h5>\n<p>Students talk to prospective employers during an all-majors career fair held at The Inn at Ole Miss.</p>\n</figcaption></figure></li>\n<li class=\"quad2\">\n<figure><img alt=\"\" src=\"http://olemiss.edu/www.olemiss.edu/_images/hero2/2016-03-01_15_50_57SKB_2725-AAweb.jpg\"/><figcaption readability=\"8\"><h5>Choir Rehearsal</h5>\n<p>Members of the University of Mississippi Concert Singers prepare for a performance at the American Choral Directors Association convention March 10 in Chattanooga, Tenn.</p>\n</figcaption></figure></li>\n<li class=\"quad3\">\n<figure><img alt=\"\" src=\"http://olemiss.edu/www.olemiss.edu/_images/hero2/2016-02-29_15_05_23Dental-White-Coat-2016_13web.jpg\"/><figcaption readability=\"6\"><h5>Dentist's Pledge</h5>\n<p>Kendra Clark (right) and other students in the UMMC School of Dentistry Class of 2018 recite the Dentist's Pledge at the American College of Dentists White Coat Ceremony held Feb. 26 in Jackson.</p>\n</figcaption></figure></li>\n</ul><div class=\"weather\">\n<p>45°</p>\n<p>Oxford, MS</p>\n</div>\n</div>\n</section>\n<div id=\"newsannouncements\" readability=\"31\">\n<section id=\"news\"><a href=\"http://news.olemiss.edu\" class=\"link2all\">ALL NEWS</a>\n<h2>Latest News</h2>\n<article>\n<h3>UM Honors 150 Students with Who's Who Distinction</h3>\n</article><article>\n<h3>UM Lazarus Project Attracts International Collaborations</h3>\n</article><article>\n<h3>Schedule Set for BancorpSouth Rebel Road Trip</h3>\n</article></section><section id=\"announcements\"><a href=\"http://olemiss.edu/newsevents/announcements.html\" class=\"link2all\">ALL ANNOUNCEMENTS</a>\n<h2>Announcements</h2>\n<ul><li readability=\"1\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=rebeccac-300-2R6EhILE.html\">Conferences — Oxford Conference for the Book</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=rebeccac-300-2R6EhILE.html\">Celebrating the written word.</a></p>\n</li>\n<li readability=\"3\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=rmwhitti-300-6zip0xir.html\">Lectures — William Winter Institute Keynote Address</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=rmwhitti-300-6zip0xir.html\">Dr. Susan Neiman will provide the keynote address, 'Learning from the Germans: What Can They Teach Us about Racial Reconciliation'</a></p>\n</li>\n<li readability=\"4\">\n<h3><a href=\"http://olemiss.edu/#\">Campus News — Conversation with Dr. Susan Neiman</a></h3>\n<p><a href=\"http://olemiss.edu/#\">Dr. Neiman will speak with campus activists on memory and iconography on Thursday, March 3 at the William Winter Institute in Lamar Hall</a></p>\n</li>\n<li readability=\"6\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=nicwea-300-pxgOJp5E.pdf\">Class News — Watercolor In London Meeting THIS Thursday!</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=nicwea-300-pxgOJp5E.pdf\">Summer Study Abroad Watercolor in London meeting THIS THURSDAY, March 3rd, Noon, Meek 110. Don't miss out and BRING A FRIEND!</a></p>\n</li>\n<li readability=\"5\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=mlong-300-nGVc0sVA.html\">Lectures — Porter L. Fortune, Jr. History Symposium</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=mlong-300-nGVc0sVA.html\">Dr. Robert Karl, of Princeton University, will present the Keynote Address at the 2016 Porter L. Fortune, Jr. History Symposium.</a></p>\n</li>\n<li readability=\"3\">\n<h3><a href=\"http://goo.gl/forms/MCxDZ1E3tZ\">Green Initiative — ASB Seeks Input on Bicycle Issues</a></h3>\n<p><a href=\"http://goo.gl/forms/MCxDZ1E3tZ\">ASB is working on resolutions to improve the bike community on campus! Let us know what you think by taking this quick survey-new link.</a></p>\n</li>\n<li readability=\"2\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=jamunson-300-PkJPHikV.pdf\">Academics — Breakfast For Dinner? It Is At Lenoir Dining!</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=jamunson-300-PkJPHikV.pdf\">It's breakfast for dinner this week at Lenoir Dining. Make your reservations online at lenoirdining.com or by calling 662-915-1863.</a></p>\n</li>\n<li readability=\"2\">\n<h3><a href=\"http://olemiss.edu/#\">Invitation — Tallahatchie Toastmasters Meeting</a></h3>\n<p><a href=\"http://olemiss.edu/#\">Anyone interested in improving their communication and leadership skills are welcome to attend the meeting. Guests are always welcome!</a></p>\n</li>\n<li readability=\"4\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=cekalu-300-pukIwGmb.html\">Invitation — Oxford Writers Featured at Overby Center</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=cekalu-300-pukIwGmb.html\">The extraordinary literary community in Oxford will be the subject of a panel discussion at the Overby Center, followed by a reception.</a></p>\n</li>\n<li readability=\"1\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=rebeccac-300-hWem8ZK1.html\">Conferences — Oxford Conference for the Book</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=rebeccac-300-hWem8ZK1.html\">Celebrating the written word.</a></p>\n</li>\n<li readability=\"6\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=mlong-300-XkqfHOm8.html\">Brown Bag — Croft Professor Lecture Series: Dr. Joshua First</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=mlong-300-XkqfHOm8.html\">Dr. Joshua First, Croft Asst. Prof. of History, will speak on 'Ukraine's Revolution and Documentary Nationalism'; Fri., March 4; Croft 107.</a></p>\n</li>\n<li readability=\"5\">\n<h3><a href=\"http://olemiss.edu/#\">Campus News — Lunch and Learn with Dr. Susan Neiman</a></h3>\n<p><a href=\"http://olemiss.edu/#\">Dr. Susan Neiman and UM students will discuss her book, Moral Clarity, during a lunch and learn at the William Winter Institute.</a></p>\n</li>\n<li readability=\"2\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=jrbreela-300-sk5TCBl9.pdf\">Arts and Culture — Colloquium: Thalberg in the American South</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=jrbreela-300-sk5TCBl9.pdf\">This colloquium will be taught by Dr. Ian Hominick in room 136 (Small Ensemble Room) on Friday at 4 o'clock.</a></p>\n</li>\n<li>\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=kcozart-300-aSL2Edda.pdf\">Conferences — 2016 Isom Student Gender Conference</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=kcozart-300-aSL2Edda.pdf\">'Undoing the Norms'</a></p>\n</li>\n<li readability=\"1\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=ikaufman-300-dsdTiMuB.html\">Invitation — 'El Cafe' de los Lunes' Meets this Monday</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=ikaufman-300-dsdTiMuB.html\">Come practice your Spanish with us in a relaxed setting. Join us every Monday.</a></p>\n</li>\n<li readability=\"3\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=jharris-300-uAfBgf3h.html\">UM Memo — UM Faculty/Staff Appeals Committee</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=jharris-300-uAfBgf3h.html\">Location: Mississippi Small Business Development Center Boardroom, 122 Jeanette Phillips Drive. See details for map.</a></p>\n</li>\n<li readability=\"3\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=blair-300-5fkNFdmA.pdf\">Study Abroad — Scholarships for Study Abroad in China!</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=blair-300-5fkNFdmA.pdf\">UM has received two generous Chinese Government Scholarships for study in China during AY 2016/17. See Study Abroad for more info!</a></p>\n</li>\n<li readability=\"1\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=jharris-300-M98IbaPW.html\">Invitation — How to Develop a Business Plan (Oxford)</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=jharris-300-M98IbaPW.html\">This seminar is designed to assist in preparing a business plan.</a></p>\n</li>\n<li readability=\"2\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=mdennis-300-soCfN09J.pdf\">Library — Citation Management Workshop</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=mdennis-300-soCfN09J.pdf\">Join Buffy Choinski in Room 106E to learn more about using RefWorks and other tools to make your bibliographies easier!</a></p>\n</li>\n<li readability=\"1\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=rebeccac-300-efSwrORQ.html\">Brown Bag — 'Collaboration'</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=rebeccac-300-efSwrORQ.html\">Brown Bag Lecture with Ann Fisher-Wirth and Maude Schuyler Clay.</a></p>\n</li>\n<li readability=\"3\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=tbbaker-300-DeTNJicl.html\">Campus News — Register for Ole Miss Big Event 2016</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=tbbaker-300-DeTNJicl.html\">Sign up to be a part of the largest day of community service in the state of Mississippi! Registration is open on myOleMiss until 3/21.</a></p>\n</li>\n<li readability=\"3\">\n<h3><a href=\"http://technews.olemiss.edu/online-timesheets-now-required-eligible-um-employees/\">TECHNews — Online Timesheets Required - Eligible UM Employees</a></h3>\n<p><a href=\"http://technews.olemiss.edu/online-timesheets-now-required-eligible-um-employees/\">Beginning in early March,all eligible employees will be REQUIRED to record their time using the ESS Timesheet application within myOleMiss.</a></p>\n</li>\n<li readability=\"3\">\n<h3><a href=\"http://green.olemiss.edu/propose-a-project/\">Green Initiative — Green Fund Proposals Due March 23</a></h3>\n<p><a href=\"http://green.olemiss.edu/propose-a-project/\">Students, faculty &amp; staff - Receive funding for your sustainability project! Green Fund proposals are due March 23.</a></p>\n</li>\n<li readability=\"4\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=dawiley-300-xvEUewt4.html\">IT Alert — Some IT Services Unavailable March 14</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=dawiley-300-xvEUewt4.html\">System upgrades are scheduled to begin 12 a.m. on Monday, March 14. Some IT services will be unavailable until this work is completed.</a></p>\n</li>\n<li readability=\"3\">\n<h3><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=whamilton-300-vNtM6yzN.html\">Parking and Transportation — New Road Construction Near Rebel Drive Water Tower</a></h3>\n<p><a href=\"https://secure1.olemiss.edu/tools/ViewUserFile.jsp?filename=whamilton-300-vNtM6yzN.html\">Starting in March, a new road will be constructed as Phase I of the North Residential Parking Garage project.</a></p>\n</li>\n</ul></section></div>\n<hr/><hr/><section id=\"sports\" class=\"c7\"><a href=\"http://www.olemisssports.com\" class=\"link2all\">olemisssports.com</a>\n<h2>UM Athletics</h2>\n<div class=\"games\">\n<div class=\"game\">\n<h3>Men's Basketball</h3>\n<div class=\"team win\"><img src=\"http://web6.olemiss.edu/mercury/sports/10431523.olemiss.png\" alt=\"team logo\"/> Ole Miss 86</div>\n<div class=\"team\"><img src=\"http://web6.olemiss.edu/mercury/sports/10164724.msst.png\" alt=\"team logo\"/> Miss. St. 78</div>\n<p>Wednesday, Mar. 2</p>\n</div>\n<div class=\"game\">\n<h3>Men's Baseball</h3>\n<div class=\"team win\"><img src=\"http://web6.olemiss.edu/mercury/sports/10431523.olemiss.png\" alt=\"team logo\"/> Ole Miss 9</div>\n<div class=\"team\"><img src=\"http://web6.olemiss.edu/mercury/sports/10166676.memphis.png\" alt=\"team logo\"/> Memphis 7</div>\n<p>Wednesday, Mar. 2</p>\n</div>\n<div class=\"game\">\n<h3>Women's Basketball</h3>\n<div class=\"team\"><img src=\"http://web6.olemiss.edu/mercury/sports/10431523.olemiss.png\" alt=\"team logo\"/> Ole Miss 59</div>\n<div class=\"team win\"><img src=\"http://web6.olemiss.edu/mercury/sports/10166693.vanderbilt.png\" alt=\"team logo\"/> Vanderbilt 74</div>\n<p>Wednesday, Mar. 2</p>\n</div>\n</div>\n</section><footer/>\n",
258 "annotations": [],
259 "mimetype": "text/html",
260 "language": "en",
261 "reading_time": 4,
262 "domain_name": "olemiss.edu",
263 "tags": []
264 },
265 {
266 "is_archived": 1,
267 "created_at": "2016-09-08T11:55:58+0200",
268 "updated_at": "2016-09-08T11:57:16+0200",
269 "is_starred": 0,
270 "id": 96,
271 "title": "FinnChristiansen.de Jetzt Dank Let’s Encrypt Per HTTPS Erreichbar",
272 "url": "https://www.finnchristiansen.de/2015/12/06/finnchristiansen-de-jetzt-dank-lets-encrypt-per-https-erreichbar/",
273 "content": "<div class=\"entry-content-thumbnail\"><img width=\"750\" height=\"179\" src=\"https://www.finnchristiansen.de/wp-content/uploads/2015/12/letsencrypt-1024x245.png\" class=\"attachment-large size-large wp-post-image\" alt=\"letsencrypt\" srcset=\"https://www.finnchristiansen.de/wp-content/uploads/2015/12/letsencrypt-300x72.png 300w, https://www.finnchristiansen.de/wp-content/uploads/2015/12/letsencrypt-1024x245.png 1024w, https://www.finnchristiansen.de/wp-content/uploads/2015/12/letsencrypt.png 1025w\" sizes=\"(max-width: 750px) 100vw, 750px\"/></div><div class=\"entry-content\">\n<p>Wenn ich in meinen FeedReader blicke, tauchen dort viele Beiträge zu <a href=\"https://letsencrypt.org/\" target=\"_blank\">Let’s Encrypt</a> auf. <a href=\"https://letsencrypt.org/2015/12/03/entering-public-beta.html\" target=\"_blank\">Seit Donnerstag befindet sich Let’s Encrypt in der offenen Beta Phase</a> und nun kann jeder ohne vorherige Freischaltung die kostenlosen SSL Zertifikate beantragen. Das habe ich natürlich auch getan.<br/></p>\n<p>Viele meiner Seiten oder Dienste waren zwar auch schon vorher SSL-verschlüsselt erreichbar, aber meistens habe ich dafür selbstsignierte Zertifkate bzw. eine selbstsignierte Certificate Authority verwendet. Für meine ownCloud Installation hatte ich mir sogar mal ein Zertifikat gekauft, da auch andere die Cloud nutzen und ich so ohne große Erklärungen ownCloud Links versenden konnte.</p>\n<p>Zur Verwendung von Let’s Encrypt brauche ich nicht mehr viel sagen, das haben schon <a href=\"https://thomas-leister.de/internet/lets-encrypt-zertifikate-im-manual-mode-abholen/\" target=\"_blank\">Thomas Leister</a>, <a href=\"http://linuxundich.de/gnu-linux/ssl-zertifikat-lets-encrypt-synology-nas/\" target=\"_blank\">Christoph Langner</a> oder andere getan. <a href=\"https://tuxproject.de/blog/2015/12/virtualisierungswahn/\" target=\"_blank\">Auch Kritik wird geäußert</a>, da der Let’s Encrypt Client verhältnismäßig aufgebläht ist und das Erstellen eines CSRs (Zertifikatsantrag) schon ewig mit openssl auf der Konsole bestens funktioniert. Let’s Encrypt möchte diesen Prozess aber vereinfachen und sogar die Installation des Zertifikates vereinfachen und sogar automatisieren.</p>\n<p>Ich habe meine Zertifikate mit Let’s Encrypt mit meinem Arch Linux Desktop im „Manual Mode“ erstellt und per Hand auf die Server verteilt. Das ist mir lieber, als dass ich die Software auf jeden Server installiere. Handarbeit ist eh notwendig, da ich <a href=\"https://www.finnchristiansen.de/2015/08/27/tlsa-records-fuer-dane-erstellen/\" target=\"_blank\">DANE</a> einsetze und die Records eh anpassen musste.</p>\n<p>Leider können nur Zertifikate für 10 Subdomains / Host-Records einer Domain beantragt werden. Das habe ich für die 10 wichtigsten getan, die übrigen 15 kann ich hoffentlich bald nachholen. Bisher gibt es eine entsprechende Fehlermeldung, falls man versucht, mehr Zertifikate zu beantragen:</p>\n<div id=\"crayon-56d87312178e8166484796\" class=\"crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate c6\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar crayon-tools c1\" data-settings=\" mouseover overlay hide delay\">\n<div class=\"crayon-button crayon-nums-button crayon-button-icon\" title=\"Zeilennummern\"/>\n<div class=\"crayon-button crayon-plain-button crayon-button-icon\" title=\"Unformatierte Code-Ansicht\"/>\n<div class=\"crayon-button crayon-wrap-button crayon-button-icon\" title=\"Zeilenumbruch umschalten\"/>\n<div class=\"crayon-button crayon-expand-button crayon-button-icon\" title=\"Code aufklappen\"/>\n<div class=\"crayon-button crayon-copy-button crayon-button-icon\" title=\"Copy\"/>\n<div class=\"crayon-button crayon-popup-button crayon-button-icon\" title=\"Code in einem neuen Fenster anzeigen\"/>\n</div>\n<div class=\"crayon-info c2\"/>\n<div class=\"crayon-plain-wrap\">\n<textarea wrap=\"soft\" class=\"crayon-plain print-no c3\" data-settings=\"dblclick\" readonly=\"readonly\">\nError: urn:acme:error:rateLimited :: There were too many requests of a given type :: Error creating new cert :: Too many certificates already issued for: finnchristiansen.de\n</textarea></div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\"><tr class=\"crayon-row\"><td class=\"crayon-nums\" data-settings=\"show\">\n<div class=\"crayon-nums-content crayon-num c4\">1</div>\n</td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre crayon-line c5\">Error: urn:acme:error:rateLimited :: There were too many requests of a given type :: Error creating new cert :: Too many certificates already issued for: finnchristiansen.de</div>\n</td>\n</tr></table></div>\n</div>\n<p>Die Zertifikate sind 90 Tage gültig, so dass ich mir eine Erinnerung im Kalender hinterlegt habe, damit ich die Zertifikate erneuern kann. Bis dahin: Viel Spaß beim Erstellen und Einbauen der Zertifikate.</p>\n<p><em>Beitragsbild-Quelle: <a href=\"https://letsencrypt.org/\" target=\"_blank\">LetsEncrypt.org</a> – <a href=\"http://creativecommons.org/licenses/by/3.0/\">Creative Commons Attribution 3.0 License</a>.</em></p>\n</div>",
274 "annotations": [],
275 "mimetype": "text/html",
276 "language": "de-DE",
277 "reading_time": 1,
278 "domain_name": "www.finnchristiansen.de",
279 "tags": []
280 },
281 {
282 "is_archived": 1,
283 "created_at": "2016-09-08T11:55:58+0200",
284 "updated_at": "2016-09-08T11:57:16+0200",
285 "is_starred": 0,
286 "id": 82,
287 "title": "Le développeur et l'ingénierie logicielle",
288 "url": "http://wemucs.com/le-developpeur-et-lingenierie-logicielle/",
289 "content": "<p><strong>Etre un développeur, ce n'est pas juste pisser du code. Non. L'architecture de l'applicatif est bien plus importante et la conception fera la différence entre un bon et mauvais développeur.</strong></p><p>Julien Dollon a tout résumé en un seul tweet :<br/></p>\n<p>Alors, voyons un peu ce qui paraît essentiel pour progresser dans le développement et l'ingénierie logicielle plus généralement.</p>\n<h2 id=\"lesbases\">Les bases</h2>\n<p>Peu importe votre âge, que vous ayez fait de longues études dans une école prestigieuse ou non : vous devez maîtriser vos bases. J'entends par là :</p>\n<ul><li>Savoir développer sans framework ni librairie</li>\n<li>Connaitre la programmation orientée objet</li>\n<li>Etre à l'aise avec une base de données</li>\n<li>Avoir des notions de réseau</li>\n<li>S'intéresser au hardware</li>\n</ul><p>Oui, parce que si vous maîtrisez vos bases, vous comprendrez que tous les langages manipulent des données qui passent leur temps à transiter entre unités de calcul et de stockage.</p>\n<p><strong>Un bon développeur doit pouvoir changer de plateforme ou de langage très rapidement</strong>, s’imprégner d’une nouvelle base de données ou même d’un nouveau protocole en très peu de temps. A chaque fois, ce n'est que question de logique et d'implémentation.</p>\n<h2 id=\"lacuriosit\">La curiosité</h2>\n<p>L'intégrisme mène au côté obscur. Et puis, vous risquez de finir votre carrière à bosser sur des projets fait en ASP 2.0 ou en PHP 4. Chacun son truc mais ce qui fait la beauté du monde, c'est <strong>la diversité</strong>.</p>\n<p>Il est vraiment important d'être à l'aise avec un environnement et un langage. Vous coderez plus vite et vous contournerez les pièges. De l'autre côté, être ouvert sera votre plus grande force. Le PHP ou le Java ne sont pas les seuls : vous pourriez être surpris par la simplicité et la rapidité de Python et du Go, ou même des outils Unix/Linux codés en C.</p>\n<p>Si vous avez un peu de temps, n'hésitez pas à vous amusez à développer de tous petits applicatifs pour découvrir un nouveau langage. Après tout, les histoires d'amour sont souvent inattendues !</p>\n<h2 id=\"ladettetechnique\">La dette technique</h2>\n<p>On entre un peu plus dans le vif du sujet. Maîtriser ses bases, c'est bien. Connaître plusieurs langages et être à l'aise avec des frameworks, c'est mieux. Imaginer un logiciel pour qu'il soit encore en prod dans 10 ans, c'est la réussite !</p>\n<h4 id=\"projetscourtsetabsencedemaintenance\">Projets courts et absence de maintenance</h4>\n<p>Un certain nombre de développeurs bossent sur des projets assez courts (entre 3 mois et 1 an) sans en assumer la maintenance. Au final, c'est soit un autre développeur qui reprendra les spaghettis pour le debugger ou essayer d'y ajouter une fonctionnalité.</p>\n<p>Alors ça peut être super cool :</p>\n<ul><li>on peut changer souvent de techno / librairies / frameworks</li>\n<li>on peut sortir du concret très vite</li>\n<li>on peut plus facilement contribuer à l'open source avec de nouveaux projets</li>\n</ul><p>Mais vous allez inévitablement contribuer à la plus grande frustration du développeur : reprendre du code qui a plusieurs années écrit par quelqu'un d'autre… Au final, soit vous ferez un hack, soit vous ferez une librairie à part sur un patron de conception différent, <strong>augmentant la dette technique</strong>.</p>\n<p><img src=\"http://wemucs.com/content/images/2016/02/65748811.jpg\" alt=\"Shitty code\"/></p>\n<h4 id=\"projetslongsetddis\">Projets longs et dédiés</h4>\n<p>De l'autre côté, si vous travaillez chez un éditeur ou un \"client final\", vous aurez sans doute l'opportunité de travailler sur des projets qui resteront en production durant des années, voir des dizaines d'années. Et là, la vision que vous allez avoir est quelque peu différente.</p>\n<p>Je ne vais pas revenir sur ce qu'est la dette technique. <a href=\"http://blog.dollon.net/la-dette-technique/\">Julien l'a très bien décrit dans son article</a>, que je vous invite à lire à la suite.</p>\n<p>Ne pas créer de dette technique involontaire et contrôler la volontaire, ce sera votre plus grande mission. Et pour cela, pas de magie : c'est <strong>l'expérience</strong> qui parlera. Les vieux ne sont pas tous des cons et ils vous donneront souvent de précieux conseils !<br/>La plus grande réussite, c'est de pouvoir ajouter des fonctionnalités dans 10 ans à votre projet en suivant la même conception de départ avec toutes les briques déjà en place.</p>\n<p>Quelques petites remarques en vrac :</p>\n<ul><li>Bien nommer ses variables, fonctions et classes : elles doivent s'auto-décrire sans commentaire, représenter la réalité sans confusion</li>\n<li>La POO, ce n'est pas automatique : le fonctionnel permet de découpler plus facilement les briques</li>\n<li>Les micro-services, c'est bien, mais il faut faire attention de ne pas devoir gérer 50 bases de projets différents</li>\n<li>Les tests unitaires et fonctionnels sont aussi importants que l'implémentation</li>\n<li>Les librairies externes, oui, mais elles ne doivent pas devenir un poids si elles deviennent trop couplées à votre projet</li>\n<li>Et j'en passe !</li>\n</ul><h2 id=\"rflectionvsttebaisse\">Réflection vs tête baissée</h2>\n<p>Dans une vie de développeur, on rencontre à la fois des projets simples, répétitifs et un peu bateau. Ce qui nous motive réellement, ce sont les <strong>défis complexes</strong> à résoudre et heureusement, on en rencontre très souvent.</p>\n<p>Démarrer à coder tout de suite, c'est foncer tête baissée et créer des fondations fragiles. Au final, vous commencez à poser des briques pour construire votre maison sans en avoir dessiné le plan précis.</p>\n<ul><li>Comprenez les besoins métiers, et mettez-vous à la place des utilisateurs. Passez beaucoup de temps avec eux pour tout expliciter et les avertir de ce que vous pourrez et ne pourrez pas faire</li>\n<li>Faites une étude sur l'architecture et les technologies possibles : prenez un papier, un crayon et représentez-les</li>\n<li>Soyez impartial de votre décision : mettez les points positifs en regard des négatifs pour chaque possibilité</li>\n<li>Demandez d'autres avis que le votre en organisant des brainstorming. <strong>C'est en équipe que l'on avance le plus</strong>, vous mettrez sans doute en évidence des points que vous aviez oublié et il faut savoir reconnaitre que vous n'aviez pas la meilleure solution !</li>\n</ul><h2 id=\"seremettreenquestion\">Se remettre en question</h2>\n<p>Il ne faut pas seulement avoir l'impression de faire du bon travail, il est important de s'en assurer. La définition d'un \"bon\" travail va varier énormément en fonction des contextes et en fonction des attentes. Cependant, au fur et à mesure de l'avancé de vos projets, <strong>faites un point sur ce que vous venez de créer</strong> : mettez en avant les points forts avec en perspective les parties faibles.</p>\n<p><img src=\"http://wemucs.com/content/images/2016/02/continuous-improvement-cycle.gif\" alt=\"Continuous Improvement Cycle\"/></p>\n<p>Il est évident qu'avec le recul, après mise en production et sans doute les premiers bugs ou comportements non voulus, ou même simplement la difficulté de faire évoluer vos outils, vous pourrez réellement voir ce qui a cloché et comment l'éviter à l'avenir. C'est ça le travail d'un développeur et d'un ingénieur en général : aller de l'avant en étant lucide sur le passé.</p>\n<p>Oh, et surtout <strong>pas de vanité</strong>. Utilisez des métriques qui veulent vraiment dire quelque chose, n'essayez pas de cacher la vilaine classe FileUtils qui devient un cauchemar : il faut savoir être sincère dans ces moments là.</p>\n<h2 id=\"enrsum\">En résumé…</h2>\n<p>Il faut de tout pour faire un monde ! Si vous préférez changer de projets tous les 4 matins, être à l'affut de toutes les nouveautés, alors restez comme vous êtes et soyez des précurseurs !</p>\n<p>A l'inverse, si vous désirez vraiment entrer dans de la conception logicielle, la pure et dure, alors je vous conseille fortement de travailler sur des projets au long court. Cela ne vous empêchera pas de vous éclatez, mais vous allez pouvoir vraiment réfléchir à ce qu'est un bon logiciel et ce qui ne l'est pas.</p>\n<p>Et puis, si vous le pouvez, <strong>bossez avec des pointures</strong> dans le domaine. Apprenez sur le tas avec des séniors qui ont des années de dev dans les baskets. Ils seront sans doute de précieux conseils, même si votre première Pull Request aura sans doute 3 commentaires par ligne !</p>\n<p><img src=\"http://wemucs.com/content/images/2016/02/57772588.jpg\" alt=\"Self merged\"/></p>\n",
290 "annotations": [],
291 "mimetype": "text/html",
292 "reading_time": 6,
293 "domain_name": "wemucs.com",
294 "tags": []
295 },
296 {
297 "is_archived": 1,
298 "created_at": "2016-09-08T11:55:58+0200",
299 "updated_at": "2016-09-08T11:57:16+0200",
300 "is_starred": 0,
301 "id": 78,
302 "title": "The Role of Methylation in Gene Expression",
303 "url": "http://www.nature.com/scitable/topicpage/the-role-of-methylation-in-gene-expression-1070",
304 "content": "<p>Today, researchers know that DNA methylation occurs at the cytosine bases of eukaryotic DNA, which are converted to 5-methylcytosine by DNA methyltransferase (DNMT) enzymes. The altered cytosine residues are usually immediately adjacent to a guanine nucleotide, resulting in two methylated cytosine residues sitting diagonally to each other on opposing DNA strands. Different members of the DNMT family of enzymes act either as <em>de novo</em> DNMTs, putting the initial pattern of methyl groups in place on a DNA sequence, or as maintenance DNMTs, copying the methylation from an existing DNA strand to its new partner after replication. Methylation can be observed by staining cells with an immunofluorescently labeled antibody for 5-methylcytosine. In mammals, methylation is found sparsely but globally, distributed in definite CpG sequences throughout the entire genome, with the exception of CpG islands, or certain stretches (approximately 1 kilobase in length) where high CpG contents are found. The methylation of these sequences can lead to inappropriate gene silencing, such as the <a href=\"http://www.nature.com/scitable/topicpage/Tumor-Suppressor-TS-Genes-and-the-Two-887\" onclick=\"return isUDV('/topicpage/Tumor-Suppressor-TS-Genes-and-the-Two-887');\" title=\"silencing of tumor suppressor genes in cancer cells\">silencing of tumor suppressor genes in cancer cells</a>.</p>\n<p>Currently, the mechanism by which <em>de novo</em> DNMT enzymes are directed to the sites that they are meant to silence is not well understood. However, researchers have determined that some of these DNMTs are part of <a href=\"http://www.nature.com/scitable/topicpage/Chromatin-Remodeling-in-Eukaryotes-1082\" onclick=\"return isUDV('/topicpage/Chromatin-Remodeling-in-Eukaryotes-1082');\" title=\"chromatin-remodeling complexes\">chromatin-remodeling complexes</a> and serve to complete the remodeling process by performing on-the-spot DNA methylation to lock the closed shape of the chromatin in place.</p>\n<p>The roles and targets of DNA methylation vary among the kingdoms of organisms. As previously noted, among Animalia, mammals tend to have fairly globally distributed CpG methylation patterns. On the other hand, invertebrate animals generally have a \"mosaic\" pattern of methylation, where regions of heavily methylated DNA are interspersed with nonmethylated regions. The global pattern of methylation in mammals makes it difficult to determine whether methylation is targeted to certain gene sequences or is a default state, but the CpG islands tend to be near transcription start sites, indicating that there is a recognition system in place.</p>\n<p>Plantae are the most highly methylated eukaryotes, with up to 50% of their cytosine residues exhibiting methylation. Interestingly, in Fungi, only repetitive DNA sequences are methylated, and in some species, methylation is absent altogether, or it occurs on the DNA of <a href=\"http://www.nature.com/scitable/topicpage/Transposons-or-Jumping-Genes-Not-Junk-DNA-1211\" onclick=\"return isUDV('/topicpage/Transposons-or-Jumping-Genes-Not-Junk-DNA-1211');\" title=\"Transposons\">transposable elements</a> in the genome. The mechanism by which the transposons are recognized and methylated appears to involve <a href=\"http://www.nature.com/scitable/topicpage/Small-Non-coding-RNA-and-Gene-Expression-1078\" onclick=\"return isUDV('/topicpage/Small-Non-coding-RNA-and-Gene-Expression-1078');\" title=\"siRNA\">small interfering RNA</a> (siRNA). The whole silencing mechanism invoking DNMTs could be a way for these organisms to defend themselves against viral infections, which could generate transposon-like sequences. Such sequences can do less harm to the organism if they are prevented from being expressed, although replicating them can still be a burden (Suzuki &amp; Bird, 2008). In other fungi, such as fission yeast, siRNA is involved in gene silencing, but the targets include structural sequences of the chromosomes, such as the centromeric DNA and the telomeric repeats at the chromosome ends. </p>\n",
305 "annotations": [],
306 "mimetype": "text/html",
307 "language": "en",
308 "reading_time": 2,
309 "domain_name": "www.nature.com",
310 "tags": []
311 },
312 {
313 "is_archived": 1,
314 "created_at": "2016-09-08T11:55:58+0200",
315 "updated_at": "2016-09-08T11:57:16+0200",
316 "is_starred": 0,
317 "id": 53,
318 "title": "E-Mail-Adresse kostenlos, FreeMail, De-Mail & Nachrichten",
319 "url": "http://web.de",
320 "content": "<div class=\"r2\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"1\" readability=\"12\">\nNPD setzt auf Verzögerungen\n<p>Rechtsextremisten kämpfen vor Verfassungsgericht um ihr Überleben.</p>\n</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"8\">\n<a href=\"http://web.de/magazine/politik/frank-buschmann-schockiert-menschen-geschrieben-31389104\" data-teaser-id=\"31389104\" data-teaser-type=\"DEFAULT\">Schockiert über den Hass</a>\n<p>Kommentator Frank Buschmann spricht über Reaktionen auf sein Merkel-Lob.</p>\n</div>\n</div>\n</div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"11\">\nSchlägerei nach One-Night-Stand</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"11\">\nPartei \"Die Rechte\" sorgt für Eklat</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"11\">\nScheibe vereist? Das hilft!</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://web.de/magazine/wissen/deutscher-weltenbummler-mumifiziert-yacht-gefunden-31382634\" data-teaser-id=\"31382634\" data-teaser-type=\"DEFAULT\" data-reco-teaser=\"1\"><img src=\"http://i1.web.de/image/734/31382734,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Yacht\" width=\"72\" height=\"54\"/></a> Die Yacht des deutschen Weltenbummlers Manfred Fritz Bajorat wurde vor der philippinischen Küste gefunden.</li>\n<li><a href=\"http://web.de/magazine/panorama/one-night-stand-endet-unschoenem-ausgang-31384014\" data-teaser-id=\"31384014\" data-teaser-type=\"DEFAULT\" data-reco-teaser=\"1\"><img src=\"http://i1.web.de/image/078/31384078,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"One-Night-Stand\" width=\"72\" height=\"54\"/></a> Ein One-Night-Stand zweier Teenager endet anders als geplant.</li>\n<li><a href=\"http://web.de/magazine/politik/plakat-partei-rechte-haengen-plakate-31384064\" data-teaser-id=\"31384064\" data-teaser-type=\"DEFAULT\" data-reco-teaser=\"1\"><img src=\"http://i2.web.de/image/088/31384088,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"\" width=\"72\" height=\"54\"/></a> Das Landeskriminalamt in Sachsen-Anhalt prüft den Verdacht der Volksverhetzung wegen eines Wahlplakats der Partei \"Die Rechte\". (Symbolbild)</li>\n<li class=\"last\"><a href=\"http://www.auto-service.de/videos/76198-scheibe-vereist-hilft.html\" data-teaser-id=\"31384058\" data-teaser-type=\"AUTOSERVICE\" target=\"_blank\" data-reco-teaser=\"1\"><img src=\"http://i1.web.de/image/054/31384054,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Life Hack Eiskratzen\" width=\"72\" height=\"54\"/></a> Life Hack Eiskratzen</li>\n</ul></div>\n<div class=\"r1\">\n<div class=\"r1 news-content teaser-content\" readability=\"8\">\n<a href=\"http://web.de/magazine/sport/fussball/bundesliga/fc-bayern-pep-guardiola-wagt-experimente-31385492\" data-teaser-id=\"31385492\" data-teaser-type=\"DEFAULT\" data-reco-teaser=\"1\">Spieler leiden unter Pep</a>\n<p>Guardiola hat Angst vor dem Scheitern und opfert für den Erfolg einiges.</p>\n</div>\n</div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"1\">\n<a href=\"http://www.auto-service.de/news/76208-consumer-reports-besten-automarken-welt.html\" data-teaser-id=\"31383558\" data-teaser-type=\"AUTOSERVICE\" target=\"_blank\">Die besten Automarken der Welt</a></div>\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"12\">\nHeidi, zieh das wieder aus!</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"11\">\nDie besten Gebrauchten 2016</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"11\">\nOscars: Kate feiert mit ihrem Leo</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://www.auto-service.de/news/76208-consumer-reports-besten-automarken-welt.html\" data-teaser-id=\"31383558\" data-teaser-type=\"AUTOSERVICE\" target=\"_blank\"><img src=\"http://i2.web.de/image/554/31383554,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Consumer Reports: Das sind die zehn besten Automarken der Welt!\" width=\"72\" height=\"54\"/></a> Consumer Reports: Das sind die zehn besten Automarken der Welt!</li>\n<li><a href=\"http://web.de/magazine/unterhaltung/tv-film/oscar/oscar-2016-tops-flops-oscar-roben-31382576\" data-teaser-id=\"31382576\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i0.web.de/image/552/31383552,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Heidi Klum (l.) Flop, Charlize Theron Top!\" width=\"72\" height=\"54\"/></a> So nahe beieinander liegen manchmal die Tops und Flops auf dem Roten Teppich: Heidi Klum (l.) Flop, Charlize Theron Top!</li>\n<li><a href=\"http://www.auto-service.de/news/76134-gebrauchtwagenreport-2016-besten-gebrauchten-deutschland.html\" data-teaser-id=\"31379186\" data-teaser-type=\"AUTOSERVICE\" target=\"_blank\"><img src=\"http://i1.web.de/image/182/31379182,pd=4,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Gebrauchtwagenreport 2016: Das sind die besten Gebrauchten in Deutschland\" width=\"72\" height=\"54\"/></a> Gebrauchtwagenreport 2016: Das sind die besten Gebrauchten in Deutschland</li>\n<li class=\"last\"><a href=\"http://web.de/magazine/unterhaltung/tv-film/oscar/oscars-2016-schoensten-bilder-oscar-nacht-31382570\" data-teaser-id=\"31382570\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i1.web.de/image/776/31382776,pd=2,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Kate Winslet, Leonardo DiCaprio, Oscars 2016\" width=\"72\" height=\"54\"/></a> Kate Winslet feiert mit Leonardo DiCaprio.</li>\n</ul></div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"service-content slide-lotto\" data-slide-id=\"1\" readability=\"36\">WEB.DE Lottoservice\n<div class=\"next-draw\" readability=\"7\">Jackpothöhe am Mittwoch, 02.03.16\n<div class=\"next-draw-content\">\n<p class=\"jackpot\">1</p>\n<a href=\"http://lotto.web.de/webshop/product/lottonormal/?partnerId=0WEHOMDISP&amp;advertisementId=0HPMODU000000000JACKPOTHO000LO000000000000\"><img src=\"http://img.ui-portal.de/homepage/img/webde/bg/lotto_button.png\" height=\"22\" width=\"104\" alt=\"Lotto spielen\"/></a> Chance 1:140 Mio.</div>\n</div>\n<div class=\"last-draw\" readability=\"7\">Ziehung vom Samstag, 27.02.16\n<div class=\"winning-numbers\">\n<ol class=\"numbers\"><li>7</li>\n<li>10</li>\n<li>15</li>\n<li>25</li>\n<li>37</li>\n<li>49</li>\n</ol>\nSZ\n<ol class=\"numbers\"><li>7</li>\n</ol></div>\n</div>\nAb 18 Jahren. Suchtgefahr. Hilfe bei www.bzga.de.</div>\n<div class=\"service-content slide-eurojackpot\" data-slide-id=\"2\" readability=\"36\">WEB.DE Lottoservice\n<div class=\"next-draw\" readability=\"7\">Jackpothöhe am Freitag, 04.03.16\n<div class=\"next-draw-content\">\n<p class=\"jackpot\">40</p>\n<a href=\"http://lotto.web.de/webshop/product/eurojackpot/?partnerId=0WEHOM0HOM&amp;advertisementId=0HPMODU000000000EUROJACKPO000EJ000000000000\"><img src=\"http://img.ui-portal.de/homepage/img/webde/bg/eurojackpot_button.png\" height=\"22\" width=\"104\" alt=\"Jetzt spielen\"/></a> Chance 1:95 Mio.</div>\n</div>\n<div class=\"last-draw\" readability=\"7\">Ziehung vom Freitag, 26.02.16\n<div class=\"winning-numbers\">\n<ol class=\"numbers\"><li>9</li>\n<li>11</li>\n<li>19</li>\n<li>42</li>\n<li>45</li>\n</ol>\nEZ\n<ol class=\"numbers\"><li>7</li>\n<li>10</li>\n</ol></div>\n</div>\nAb 18 Jahren. Suchtgefahr. Hilfe bei www.bzga.de.</div>\n</div>\n</div>\n<div class=\"r1 service-content\">Top 5 Artikel\n<a href=\"http://web.de/magazine/news/\">Weitere Nachrichten</a></div>\n<div class=\"r1 service-content\"><a href=\"http://web.de/magazine/unterhaltung/lifestyle/horoskop/\">Horoskop</a>\n</div>\n<div class=\"r2\">\n<div class=\"r1 news-content\"><a href=\"http://web.de/magazine/auto/\">Auto-Service</a>\n<div class=\"teaser-content\" readability=\"8\">\n<a href=\"http://www.auto-service.de/news/genfer-autosalon/76288-panne-audi-show-moderatorin-weichselbraun-bleibt-auto-stehen.html\" data-teaser-id=\"31388878\" data-teaser-type=\"AUTOSERVICE\" target=\"_blank\">Auto-Panne bei Audi-Show</a>\n<p>Moderatorin Mirjam Weichselbraun bleibt in Genf auf der Bühne stehen.</p>\n</div>\n</div>\n<div class=\"r1 news-content teaser-content\" readability=\"8\">\n<a href=\"http://www.auto-service.de/news/genfer-autosalon/76268-bugatti-chiron-uebersportwagen-unfassbaren-1500-ps-vorgestellt.html\" data-teaser-id=\"31385222\" data-teaser-type=\"AUTOSERVICE\" target=\"_blank\">1.500 Bugatti-PS - Wahnsinn!</a>\n<p>Der neue \"Chiron\" feiert auf dem Autosalon in Genf seine Premiere.</p>\n</div>\n<div class=\"r1 news-content teaser-content\" readability=\"7\">\n<a href=\"http://www.auto-service.de/news/genfer-autosalon/76276-mercedes-c-klasse-cabrio-open-air-spass-367-ps.html\" data-teaser-id=\"31385422\" data-teaser-type=\"AUTOSERVICE\" target=\"_blank\">Premiere für die offene C-Klasse</a>\n<p>Das brandneue Mercedes C-Klasse Cabrio rollt nach Genf.</p>\n</div>\n</div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"11\">\nRiskante Havarie in der Antarktis</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"11\">\nSchnee sorgt für viele Unfälle</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"11\">\nExplosion auf Kraftwerksgelände</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://web.de/magazine/politik/fluechtlingskrise-in-europa/dschungel-calais-zerstoerung-fluechtlingslager-gestattet-31377034\" data-teaser-id=\"31377034\" data-teaser-type=\"VIDEO\"><img src=\"http://i2.web.de/image/032/31377032,pd=1,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Zerstörung von Flüchtlingslager bei Calais gestattet\" width=\"72\" height=\"54\"/></a> Frankreichs Innenminister Bernard Cazeneuve begrüßte die Entscheidung und versprach Hilfe.</li>\n<li><a href=\"http://web.de/magazine/panorama/havarie-antarktis-31375668\" data-teaser-id=\"31375668\" data-teaser-type=\"VIDEO\"><img src=\"http://i1.web.de/image/666/31375666,pd=1,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Havarie in der Antarktis\" width=\"72\" height=\"54\"/></a> Der australische Eisbrecher Aurora Australis ist auf dem Weg zu einer Forschungsstation auf Grund gelaufen. Wegen schwieriger Witterungsbedingungen blieb das Ausmaß des dabei entstandenen Schadens zunächst unklar.</li>\n<li><a href=\"http://web.de/magazine/politik/winter-fruehling-schnee-eis-sorgen-unfaelle-31375364\" data-teaser-id=\"31375364\" data-teaser-type=\"VIDEO\"><img src=\"http://i0.web.de/image/362/31375362,pd=1,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Winter zum Frühling: Schnee und Eis sorgen für Unfälle\" width=\"72\" height=\"54\"/></a> Zum meteorologischen Frühlingsbeginn Anfang März stehen die Zeichen auf Schnee. Nach Auskunft der Wetterexperten ist mit einem Temperaturabfall und Glätte zu rechnen. Im Erzgebirge hatten die Autofahrer schon seit Wochenbeginn zu kämpfen.</li>\n<li class=\"last\"><a href=\"http://web.de/magazine/panorama/medien-explosion-britischem-kraftwerksgelaende-31371758\" data-teaser-id=\"31371758\" data-teaser-type=\"VIDEO\"><img src=\"http://i0.web.de/image/756/31371756,pd=1,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Laut Medien Explosion auf britischem Kraftwerksgelände\" width=\"72\" height=\"54\"/></a> Es soll westlich von London Opfer gegeben haben.</li>\n</ul></div>\n<p><a href=\"http://route.web.de/\">Routenplaner</a> Der richtige Weg <a href=\"http://web.de/magazine/video/\">Video</a> Die besten Clips <a href=\"http://tv.web.de\">Fernsehprogramm</a> Die besten Serien, Filme und Sport-Events auf einen Blick <a href=\"https://millionenklick.web.de/#C0101041109010101\" target=\"_blank\">MillionenKlick</a> Jetzt mitmachen!</p>\n<p><a href=\"http://web.de/magazine/unicef/\">Unicef</a> Helfen Sie jetzt! <a href=\"http://www.auto-service.de/staumelder/\" target=\"_blank\">Staumelder</a> Gute Fahrt! <a href=\"http://web.de/magazine/reise/ferientermine/\">Schulferien</a> Urlaub planen <a href=\"http://web.de/magazine/unterhaltung/comic/\">Comics</a> Witzig, witzig</p>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"12\">\nVerschollen, aber überlebt</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"11\">\nKorallenriffe sterben im Pazifik</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"12\">\nWer hier eine Stunde bleibt, ist tot</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://web.de/magazine/digital/laendern-selfie-toten-31341552\" data-teaser-id=\"31341552\" data-teaser-type=\"DEFAULT\"><img src=\"http://i2.web.de/image/578/31341578,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Selfie\" width=\"72\" height=\"54\"/></a> Um sich selbst spektakulär in Szene zu setzen, verhalten sich vor allem junge Menschen extrem.</li>\n<li><a href=\"http://web.de/magazine/wissen/robinson-crusoe-verschollenen-ueberlebt-31322746\" data-teaser-id=\"31322746\" data-teaser-type=\"DEFAULT\"><img src=\"http://i2.web.de/image/428/31332428,pd=4,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Jose Salvador Alvarenga \" width=\"72\" height=\"54\"/></a> Jose Salvador Alvarenga verschwand im November 2012 und tauchte im Januar 2014 wieder auf.</li>\n<li><a href=\"http://web.de/magazine/wissen/satellitenbilder-weltall-9077788\" data-teaser-id=\"9077788\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i1.web.de/image/762/31375762,pd=4,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Fatu Huku Pazifik El Nino\" width=\"72\" height=\"54\"/></a> El Niño, die ungewöhnlichen Strömungen im Pazifischen Ozean, bedroht die Korallenriffe. Die Korallen werden durch die Strömungen ausgebleicht. Es wird befürchtet, dass dieses Jahr Riffe weltweit bedroht sind. Das Bild zeigt die Pazifik-Insel Fatu Huku und wurde vom europäischen Satelliten Sentinel-2 aufgenommen. Es dient zur Überprüfung der Korallen-Schäden.</li>\n<li class=\"last\"><a href=\"http://web.de/magazine/wissen/mystery/karatschai-see-russland-gefaehrlichste-ort-welt-31327140\" data-teaser-id=\"31327140\" data-teaser-type=\"DEFAULT\"><img src=\"http://i1.web.de/image/546/31327546,pd=5,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Mystery\" width=\"72\" height=\"54\"/></a> Der Karatschai-See in Russland gilt als gefährlichster Ort der Welt.</li>\n</ul></div>\n<div class=\"r1 service-content\">WEB.DE Produkte\n<a href=\"https://produkte.web.de/#.hp.int.produktebox\">Weitere Produkte</a></div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\">\nDe-Mail</div>\n<div class=\"teaser-content\" data-slide-id=\"3\">\nMail App</div>\n<div class=\"teaser-content\" data-slide-id=\"4\">\nBrowser</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"https://produkte.web.de/mailcheck/#.hp.int.produktebox\" data-teaser-id=\"30017408\" data-teaser-type=\"DEFAULT\"><img src=\"http://i2.web.de/image/402/30017402,pd=17,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"\" width=\"72\" height=\"54\"/></a> WEB.DE Mailcheck</li>\n<li><a href=\"https://produkte.web.de/de-mail/#.hp.int.produktebox\" data-teaser-id=\"30017424\" data-teaser-type=\"DEFAULT\"><img src=\"http://i2.web.de/image/420/30017420,pd=17,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"\" width=\"72\" height=\"54\"/></a></li>\n<li><a href=\"https://produkte.web.de/freemail_mobile_startseite/mail-app/#.hp.int.produktebox\" data-teaser-id=\"30017430\" data-teaser-type=\"DEFAULT\"><img src=\"http://i1.web.de/image/428/30017428,pd=17,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Mobile Apps\" width=\"72\" height=\"54\"/></a></li>\n<li class=\"last\"><a href=\"https://produkte.web.de/browser/#.hp.int.produktebox\" data-teaser-id=\"30017436\" data-teaser-type=\"DEFAULT\"><img src=\"http://i1.web.de/image/434/30017434,pd=17,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Audible\" width=\"72\" height=\"54\"/></a></li>\n</ul></div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"11\">\nDie Missen und ihre sexy Tattoos</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"11\">\nSo lief die Wahl der Miss Germany</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"11\">\nMissen-Shooting am Strand</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://web.de/magazine/unterhaltung/lifestyle/miss-internet/schoen-miss-germany-2016-lena-broeder-31367418\" data-teaser-id=\"31367418\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i0.web.de/image/294/31368294,pd=6,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Lena Bröder Miss Germany 2016\" width=\"72\" height=\"54\"/></a> Lena Bröder (M.) und ihre beiden Stellvertreterinnen Francesca Orru (l.) und Katharina Schubert (r.) nach der Wahl zur Miss Germany 2016.</li>\n<li><a href=\"http://web.de/magazine/unterhaltung/lifestyle/miss-internet/miss-germany-2016-missen-sexy-tattoos-31341074\" data-teaser-id=\"31341074\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i2.web.de/image/014/31341014,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Missen Tattoos Noten\" width=\"72\" height=\"54\"/></a> In diesem Tattoo steckt so einiges: Im \"L\" beim Wort Liebe hat sich ein Unendlichkeitszeichen versteckt, die Blumen erinnern aber daran, dass auch die Liebe welken kann. Und die Noten sind ein kurzer Ausschnitt aus dem Soundtrack von \"Die fabelhafte Welt der Amelie\". Große Körperkunst.</li>\n<li><a href=\"http://web.de/magazine/unterhaltung/lifestyle/miss-internet/miss-germany-2016-religionslehrerin-schoenste-deutschlands-31365694\" data-teaser-id=\"31365694\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i2.web.de/image/686/31365686,pd=4,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Olga Hoffmann und Lena Bröder\" width=\"72\" height=\"54\"/></a> Die Krone bekommt die frischgebackene Miss Germany von ihrer Vorgängerin Olga Hoffmann aufgesetzt.</li>\n<li class=\"last\"><a href=\"http://web.de/magazine/unterhaltung/lifestyle/miss-internet/miss-germany-2016-missen-shooting-strand-31333712\" data-teaser-id=\"31333712\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i1.web.de/image/672/31333672,pd=6,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Missen am Strand\" width=\"72\" height=\"54\"/></a> Sieht ein bisschen so aus, als gäbe es da etwas umsonst. Schuhe vielleicht?</li>\n</ul></div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"11\">\nExklusiver Clip: \"Eddie the Eagle\"</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"11\">\nExklusiver Clip: \"Spotlight\"</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"11\">\nEinblick in den Film \"Zoomania\"</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://web.de/magazine/unterhaltung/tv-film/aktuelle-kinotrailer/exklusiv-trailer-angry-birds-film-31371008\" data-teaser-id=\"31371008\" data-teaser-type=\"VIDEO\"><img src=\"http://i0.web.de/image/006/31371006,pd=2,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"AngryBirds2\" width=\"72\" height=\"54\"/></a> AngryBirds2</li>\n<li><a href=\"http://web.de/magazine/unterhaltung/tv-film/aktuelle-kinotrailer/exklusiver-clip-eddie-the-eagle-31367488\" data-teaser-id=\"31367488\" data-teaser-type=\"VIDEO\"><img src=\"http://i2.web.de/image/486/31367486,pd=2,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"EddieEagleClip\" width=\"72\" height=\"54\"/></a> EddieEagleClip</li>\n<li><a href=\"http://web.de/magazine/unterhaltung/tv-film/aktuelle-kinotrailer/exklusiver-clip-spotlight-31361458\" data-teaser-id=\"31361458\" data-teaser-type=\"VIDEO\"><img src=\"http://i2.web.de/image/456/31361456,pd=2,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"SpotlightClip\" width=\"72\" height=\"54\"/></a> SpotlightClip</li>\n<li class=\"last\"><a href=\"http://web.de/magazine/unterhaltung/tv-film/aktuelle-kinotrailer/exklusiver-clip-zoomania-31359474\" data-teaser-id=\"31359474\" data-teaser-type=\"VIDEO\"><img src=\"http://i1.web.de/image/472/31359472,pd=2,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"ZoomaniaClip\" width=\"72\" height=\"54\"/></a> ZoomaniaClip</li>\n</ul></div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"11\">\nPlötzlich Mutter: Ist das möglich?</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"11\">\nTödliche Geißel der Menschheit</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"11\">\nMuss ich zur Krebsvorsorge?</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://web.de/magazine/gesundheit/500-kalorien-31356692\" data-teaser-id=\"31356692\" data-teaser-type=\"VIDEO\"><img src=\"http://i0.web.de/image/548/31357548,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"\" width=\"72\" height=\"54\"/></a></li>\n<li><a href=\"http://web.de/magazine/gesundheit/gntm-kandidatin-saskia-unbemerkt-schwanger-moeglich-31332426\" data-teaser-id=\"31332426\" data-teaser-type=\"DEFAULT\"><img src=\"http://i2.web.de/image/830/31332830,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Geburt Kind OP\" width=\"72\" height=\"54\"/></a> Normalerweise sendet der Körper während einer Schwangerschaft viele Zeichen. Doch nicht immer werden diese von der werdenden Mutter wahrgenommen. (Symbolbild)</li>\n<li><a href=\"http://web.de/magazine/gesundheit/krebs-unbesiegbare-geissel-menschheit-31291766\" data-teaser-id=\"31291766\" data-teaser-type=\"DEFAULT\"><img src=\"http://i2.web.de/image/422/31311422,pd=4,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Krebs, Patient, Krankenhaus\" width=\"72\" height=\"54\"/></a> Krebs rafft immer mehr Menschen dahin.</li>\n<li class=\"last\"><a href=\"http://web.de/magazine/gesundheit/krebs-fruehzeitig-erkennen-vorsorgeuntersuchungen-brauche-31298136\" data-teaser-id=\"31298136\" data-teaser-type=\"DEFAULT\"><img src=\"http://i2.web.de/image/298/31330298,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Mammographie-Screening\" width=\"72\" height=\"54\"/></a> Das Mammographie-Screening wird Frauen ab 50 alle zwei Jahre empfohlen. Das Verfahren an sich kann jedoch ebenfalls Tumore entstehen lassen.</li>\n</ul></div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"11\">\n\"Bachelorette\" macht Schluss ...</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"12\">\nWas, die sind verwandt?</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"11\">\nZiemlich dick im Geschäft</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://web.de/magazine/unterhaltung/stars/liebesnews-woche-liebt-trennt-31363836\" data-teaser-id=\"31363836\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i2.web.de/image/270/31379270,pd=4,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Jenny Elvers, Steffen von der Beeck\" width=\"72\" height=\"54\"/></a> Jenny Elvers im Glück: Ein ganzes Jahr lang konnten sie und ihr Freund Steffen von der Beeck das Geheimnis für sich behalten. Nun verriet Jenny auf ihrem Facebook-Profil, dass sie und Steffen schon seit über einem Jahr verlobt sind. Der Dschungelcamp-Kandidatin schien es lieber zu sein, selbst mit der schönen Botschaft an die Öffentlichkeit zu gehen. So ist sie den Medien zuvorgekommen.</li>\n<li><a href=\"http://web.de/magazine/unterhaltung/tv-film/bachelorette/bachelorette-alisa-patrick-zusammenziehen-31365706\" data-teaser-id=\"31365706\" data-teaser-type=\"VIDEO\"><img src=\"http://i2.web.de/image/704/31365704,pd=3,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Bachelorette_Paar_zieht_zusammen\" width=\"72\" height=\"54\"/></a> Bachelorette_Paar_zieht_zusammen</li>\n<li><a href=\"http://web.de/magazine/unterhaltung/stars/stars-verwandt-haetten-sies-gewusst-30222388\" data-teaser-id=\"30222388\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i1.web.de/image/970/31362970,pd=5,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Melissa McCarthy Jenny McCarthy\" width=\"72\" height=\"54\"/></a> Dass es sich bei Ulknudel Melissa McCarthy (l.) und Ex-Playmate Jenny McCarthy um Cousinen handelt, ist trotz des Nachnamens nur schwer vorstellbar.</li>\n<li class=\"last\"><a href=\"http://web.de/magazine/unterhaltung/stars/stars-dick-geschaeft-31361072\" data-teaser-id=\"31361072\" data-teaser-type=\"SLIDESHOW\"><img src=\"http://i0.web.de/image/460/31361460,pd=7,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Kevin James und Beth Ditto\" width=\"72\" height=\"54\"/></a> Kevin James und Beth Ditto sind \"dick im Geschäft\".</li>\n</ul></div>\n<div class=\"r1\">\n<div class=\"slider-container slider\" data-active-slide=\"1\">\n<div class=\"teaser-content\" data-slide-id=\"2\" readability=\"11\">\nEine Million Kinder in akuter Gefahr</div>\n<div class=\"teaser-content\" data-slide-id=\"3\" readability=\"11\">\nNächstenliebe als Geschenk</div>\n<div class=\"teaser-content\" data-slide-id=\"4\" readability=\"11\">\nUnsere Stiftung feiert Jubiläum</div>\n</div>\n<ul class=\"news-list\"><li class=\"first active\"><a href=\"http://web.de/magazine/unicef/gewinnspiel-aktion-geschenkte-tag-treffen-mats-hummels-31362846\" data-teaser-id=\"31362846\" data-teaser-type=\"DEFAULT\"><img src=\"http://i0.web.de/image/858/31362858,pd=6,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"UNICEF, United Internet for UNICEF, Mats Hummels, Gewinnspiel\" width=\"72\" height=\"54\"/></a> Anlässlich der Aktion \"Der geschenkte Tag\": Gewinnen Sie ein Treffen mit Mats Hummels.</li>\n<li><a href=\"http://web.de/magazine/unicef/unicef-million-kinder-ost-suedafrika-schwer-unterernaehrt-31356858\" data-teaser-id=\"31356858\" data-teaser-type=\"DEFAULT\"><img src=\"http://i0.web.de/image/286/31358286,pd=2,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"Mangelernährung, UNICEF\" width=\"72\" height=\"54\"/></a> Laut UNICEF sind knapp eine Million Kinder in Afrika schwer unterernährt.</li>\n<li><a href=\"http://web.de/magazine/unicef/valentinstag-2016-naechstenliebe-schoenste-geschenk-31347082\" data-teaser-id=\"31347082\" data-teaser-type=\"DEFAULT\"><img src=\"http://i2.web.de/image/080/31347080,pd=1,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"UNICEF, United Internet for UNICEF\" width=\"72\" height=\"54\"/></a> Zum Valentinstag wollen wir auch an diejenigen denken, denen es nicht so gut geht.</li>\n<li class=\"last\"><a href=\"http://web.de/magazine/unicef/united-internet-unicef-feiert-jubilaeum-unterstuetzer-31192220\" data-teaser-id=\"31192220\" data-teaser-type=\"DEFAULT\"><img src=\"http://i1.web.de/image/234/31192234,pd=7,h=54,mxh=600,mxw=800,w=72.jpg\" alt=\"UNICEF, United Internet for UNICEF\" width=\"72\" height=\"54\"/></a> Die Stiftung United Internet for UNICEF sagt DANKE.</li>\n</ul></div>\n",
321 "annotations": [],
322 "mimetype": "text/html",
323 "language": "de",
324 "reading_time": 4,
325 "domain_name": "web.de",
326 "tags": []
327 },
328 {
329 "is_archived": 1,
330 "created_at": "2016-09-08T11:55:58+0200",
331 "updated_at": "2016-09-08T11:57:16+0200",
332 "is_starred": 0,
333 "id": 48,
334 "title": "OpenSSH Server on Arch Linux | DominicM test",
335 "url": "http://dominicm.com/openssh-server-arch-linux/",
336 "content": "<p><a href=\"http://dominicm.com/openssh-server-arch-linux/\"><img class=\"aligncenter wp-image-2354 size-medium\" title=\"OpenSSH Server on Arch Linux\" src=\"http://dominicm.com/wp-content/uploads/2016/01/ssh-arch-linux-450x450.png\" alt=\"OpenSSH Server on Arch Linux\" width=\"450\" height=\"450\" srcset=\"http://dominicm.com/wp-content/uploads/2016/01/ssh-arch-linux-150x150.png 150w, http://dominicm.com/wp-content/uploads/2016/01/ssh-arch-linux-450x450.png 450w, http://dominicm.com/wp-content/uploads/2016/01/ssh-arch-linux-768x768.png 768w, http://dominicm.com/wp-content/uploads/2016/01/ssh-arch-linux-1024x1024.png 1024w, http://dominicm.com/wp-content/uploads/2016/01/ssh-arch-linux-60x60.png 60w, http://dominicm.com/wp-content/uploads/2016/01/ssh-arch-linux.png 1200w\" sizes=\"(max-width: 450px) 100vw, 450px\"/></a></p>\n<p>OpenSSH allows powerful and convenient way to remotely access remote systems. However it creates a possible security weakness which is one reason it is not installed by default. With proper configuration it can be secured and allows the administration of headless servers servers or other devices.</p>\n\n<h2>Install OpenSSH</h2>\n<p>Install from the official repository.</p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">\nsudo pacman -S openssh\n</pre>\n\n<h2>Configure OpenSSH</h2>\n<p>Open the configuration file.</p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">\nsudo nano /etc/ssh/sshd_config\n</pre>\n\n<p>Uncomment and or modify the desired lines in the configuration file and save.</p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">\nAllowUsers user1 user2\nAllowGroups group1 group2\nPermitRootLogin no\nPort 22\n</pre>\n<p>Only certain users can be allowed to login by listing them after <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">AllowUsers</code>. Analogously <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">AllowGroups</code> option allows users in listed groups to login. Root login can be controlled with <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">PermitRootLogin</code> option, <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">yes</code> to allow, <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">no</code> to disallow and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">without-password</code> to allow only with public key authentication. This should be set to <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">no</code> in almost always for security purposes. Root access can still be gained with the use of <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo</code> or <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">su</code> commands.</p>\n<p>Default <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Port</code> is set to <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">22</code> which can make it easier for automated bots to attempt to login. In practice changing the default SSH port does not improve security but can reduce attempted logins which can fill the logs with errors. Using ports above <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">1024</code> can actually be detrimental to security as ports below <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">1024</code> are restricted to root access while ports above can be listened to by non-root users.</p>\n\n<p>For improved security and convenience it is also recommended to configure password-less SSH logins. Optionally also configure print Screenfetch on SSH login.</p>\n\n<h2>Run OpenSSH</h2>\n<p>SSH can be started as a daemon with sshd however this is not recommended in most cases. It is better to start SSH on demand. When a socket service is started it will listen for incoming connections and will only then start the daemon process.</p>\n\n<p>Start the socket service.</p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">\nsudo systemctl start sshd.socket\n</pre>\n\n<p>Enable the socket service to run on boot.</p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">\nsudo systemctl enable sshd.socket\n</pre>\n",
337 "annotations": [],
338 "mimetype": "text/html",
339 "language": "en-GB",
340 "reading_time": 1,
341 "domain_name": "dominicm.com",
342 "preview_picture": "http://dominicm.com/wp-content/uploads/2016/01/ssh-arch-linux.png",
343 "tags": []
344 },
345 {
346 "is_archived": 1,
347 "created_at": "2016-09-08T11:55:58+0200",
348 "updated_at": "2016-09-08T11:57:16+0200",
349 "is_starred": 0,
350 "id": 39,
351 "title": "Site Moved | Site Help",
352 "url": "http://g1.com/help/sitemoved.asp",
353 "content": "<ul id=\"breadcrumbs\"><li class=\"level1\"><a href=\"http://g1.com/\" rel=\"home\">Home</a></li>\n<li><a href=\"http://g1.com/Support/\">Support</a></li>\n<li><a href=\"http://g1.com/Help/\">Site Help</a></li>\n<li id=\"lastItem\">Site Moved</li>\n</ul>\n<p>The Group 1 Software website has been discontinued and has been replaced by the Pitney Bowes Software website. For support of your Group 1 Software product, visit <a href=\"http://www.g1.com/Support/\" title=\"Group 1 Support website\">http://www.g1.com/Support/</a>. For information about our products, please visit <a href=\"http://www.pb.com/software\" title=\"Pitney Bowes Software website\">http://www.pb.com/software</a>.</p>\n<ul id=\"altPage\"><li><a href=\"http://g1.com/Help/TellAFriend.asp\" class=\"envelope\">Tell a Friend</a></li>\n</ul>\n",
354 "annotations": [],
355 "mimetype": "text/html",
356 "language": "en",
357 "reading_time": 0,
358 "domain_name": "g1.com",
359 "tags": []
360 },
361 {
362 "is_archived": 1,
363 "created_at": "2016-09-08T11:55:58+0200",
364 "updated_at": "2016-09-08T11:57:16+0200",
365 "is_starred": 0,
366 "id": 38,
367 "title": "#Maroc : le stylo anti-pédophiles EAGLE d’AMESYS est moins bien configuré que les faux-lowers Twitter du roi Mohammed VI",
368 "url": "https://reflets.info/maroc-le-stylo-anti-pedophiles-eagle-damesys-est-moins-bien-configure-que-les-faux-lowers-twitter-du-roi-mohammed-vi/",
369 "content": "<p><a href=\"http://reflets.info/wp-content/uploads/2013/08/pedobear.jpg\" data-rel=\"lightbox-0\" title=\"\"><img class=\"size-medium wp-image-26091 alignright\" alt=\"pedobear\" src=\"http://reflets.info/wp-content/uploads/2013/08/pedobear-350x301.jpg\" width=\"350\" height=\"301\" srcset=\"https://reflets.info/wp-content/uploads/2013/08/pedobear-350x301.jpg 350w, https://reflets.info/wp-content/uploads/2013/08/pedobear-550x473.jpg 550w, https://reflets.info/wp-content/uploads/2013/08/pedobear.jpg 610w\" sizes=\"(max-width: 350px) 100vw, 350px\"/></a>Le EAGLE déployé par Amesys / Bull au Maroc n’y aura rien fait. Quand la justice attrape un pédo-criminel, ce dernier trouve le moyen de se faire gracier. On peut au bas mot parler d’un sérieux dysfonctionnement de l’institution judiciaire et se demander quel genre de bug qui a pu provoquer ce malaise. En attendant, les bots Twitter de Sa Majesté sont bien présents pour tenter de récupérer la boulette. Mais comme d’habitude dans ce genre de cas, c’est tellement mal fait que ça se voit beaucoup.</p>\n<h3 class=\"c3\">Previously in PopCorn</h3>\n<p class=\"c4\">Deux millions d’euros rien qu’en disques durs, des mois de déploiement. Cet EAGLE béta testé par Kadhafi sur sa population est maintenant en production au Maroc. Evidemment Amesys / Bull contribue toujours activement (mais <a title=\"Advanced Middle East Systems, le Amesys nouveau est de retour en Libye\" href=\"http://reflets.info/advanced-middle-east-systems-le-amesys-nouveau-est-de-retour-en-libye/\">plus sous pavillon français</a> depuis un sombre <a title=\"Bull vend Eagle… à un actionnaire de Crescendo, qui est l’actionnaire principal de… Bull\" href=\"http://reflets.info/bull-vend-eagle-a-un-actionnaire-de-crescendo-qui-est-lactionnaire-principal-de-bull/\">tour de passe passe</a>) au paramétrage et à la formation des autorités marocaines pour mettre sur écoute l’ensemble de la population marocaine. Popcorn c’est le petit nom du projet du EAGLE marocain, nous vous en avions déjà assez largement parlé. L’amitié franco-marocaine c’est une bien belle histoire : ses accords de coopération policière, sa lutte contre les pédophiles et les narco trafiquants, et évidemment, la mise sur écoute téléphonique de ses 32 millions d’habitants et l’interception des communications de ses 1,5 millions d’accès Internet et de ses 14 millions d’internautes…</p>\n<p class=\"c4\">Il faut dire qu’EAGLE partait avec de sérieux avantages sur la concurrence, les technologies de BULL ont déjà fait leur preuve en Libye (projet CANDY), au Qatar (projet FINGER), au GABON (projet CROCO) ainsi que dans d’autres pays ou l’amitié bilatérale se traduit également à grand renfort de cyber-matraques.</p>\n<h3 class=\"c3\">Le stylo traqueur de pédophiles</h3>\n<p class=\"c4\">Quand on demandait à Amesys pourquoi et comment Abdallah al Senousi, un terroriste notoire, s’était vu confier un outil comme Eagle en Libye pour surveiller l’ensemble de sa population, la réponse de Bruno Samtmann, directeur commercial d’Amesys, se faisait rassurante, pour lui, <a href=\"http://reflets.info/amesys-la-justice-et-la-morale/\" target=\"_blank\">Amesys avait fourni à Kadhafi un stylo traqueur de pédophiles, de narco trafiquants et terroristes</a>… ça ne s’invente pas. C’est exactement ce même genre de stylo qu’Amesys a fournit aux autorités marocaines qui a donc en toute logique placé l’ensemble de la population du pays sous écoute.</p>\n<iframe src=\"http://player.vimeo.com/video/41977398?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff\" height=\"400\" width=\"500\" allowfullscreen=\"\" frameborder=\"0\"> </iframe>\n<p class=\"c5\"><a href=\"http://vimeo.com/41977398\" data-rel=\"lightbox-video-0\">Traqué – documentaire de Paul Moreira – Canal+</a> from <a href=\"http://vimeo.com/fhimtcom\">fhimt.com</a> on <a href=\"https://vimeo.com\">Vimeo</a>.</p>\n<p class=\"c4\">Manque de bol, pour une fois que le Maroc arrête un pédophile, voilà que le roi le gracie ! Mais à quoi peut bien servir cet Eagle au juste s’il ne permet même pas aux autorités marocaines de conserver en prison des pédophiles qu’ils ont déjà arrêté, condamné et mis en prison ?</p>\n<h3>Un plugin Eagle à bots Twitter ?</h3>\n<p class=\"c4\">Pour désamorcer la contestation au sujet du Daniel Gate sur les réseaux sociaux, les matraques ne sont pas encore parfaitement au point. Configurer un Eagle, c’est un peu long voyez vous. On utilise donc, tout naturellement, une armée de bots, des faux comptes Twitter pour twitter et retweeter la propagande de Sa Majesté. L’<a href=\"https://fr.lakome.com/index.php/maroc/1234-twitter-les-robots-de-sa-majeste\" target=\"_blank\">excellent site d’information Lakome nous explique la supercherie dans le détail</a>.</p>\n<p class=\"c5\"><a href=\"http://reflets.info/wp-content/uploads/2013/08/tweeter-robot-m6-total.jpg\" data-rel=\"lightbox-1\" title=\"\"><img class=\"aligncenter size-large wp-image-26093\" alt=\"tweeter robot m6 total\" src=\"http://reflets.info/wp-content/uploads/2013/08/tweeter-robot-m6-total-550x386.jpg\" width=\"550\" height=\"386\" srcset=\"https://reflets.info/wp-content/uploads/2013/08/tweeter-robot-m6-total-350x246.jpg 350w, https://reflets.info/wp-content/uploads/2013/08/tweeter-robot-m6-total-550x386.jpg 550w, https://reflets.info/wp-content/uploads/2013/08/tweeter-robot-m6-total.jpg 579w\" sizes=\"(max-width: 550px) 100vw, 550px\"/></a></p>\n<p class=\"c4\">Pour parfaire l’attirail autoritariste et adapter son produit aux challenges de demain, nous suggérons donc à Amesys, si ce n’est déjà fait, un plugin Eagle pour créer des bots à tweeter des âneries de manière grossière, ce afin d’éviter aux contribuables marocains d’avoir à payer grassement des agences de communication pour ce genre de propagande ridicule.</p>\n<p class=\"c5\"><a href=\"http://reflets.info/wp-content/uploads/2013/08/tweeter-robot10-liste.jpg\" data-rel=\"lightbox-2\" title=\"\"><img class=\"aligncenter size-large wp-image-26092\" alt=\"tweeter robot10 liste\" src=\"http://reflets.info/wp-content/uploads/2013/08/tweeter-robot10-liste-550x503.jpg\" width=\"550\" height=\"503\" srcset=\"https://reflets.info/wp-content/uploads/2013/08/tweeter-robot10-liste-350x320.jpg 350w, https://reflets.info/wp-content/uploads/2013/08/tweeter-robot10-liste-550x503.jpg 550w, https://reflets.info/wp-content/uploads/2013/08/tweeter-robot10-liste.jpg 573w\" sizes=\"(max-width: 550px) 100vw, 550px\"/></a></p>\n",
370 "annotations": [],
371 "mimetype": "text/html",
372 "language": "fr-FR",
373 "reading_time": 3,
374 "domain_name": "reflets.info",
375 "preview_picture": "http://reflets.info/wp-content/uploads/2013/08/tweeter-robot10-liste-550x503.jpg",
376 "tags": []
377 },
378 {
379 "is_archived": 1,
380 "created_at": "2016-09-08T11:55:58+0200",
381 "updated_at": "2016-09-08T11:57:16+0200",
382 "is_starred": 0,
383 "id": 3,
384 "title": "Simple Cloud Infrastructure for Developers",
385 "url": "https://www.digitalocean.com/",
386 "content": "<div class=\"wrapper-full\">\n<div class=\"container lighter-grey wrap-content\">\n<h3>Simple to Set Up. Flexible to Scale.</h3>\n<ul id=\"simple-setup\"><li readability=\"1\"><img src=\"https://www.digitalocean.com/assets/images/join/deploy-with-ease-ccf9cdee.svg\" alt=\"Deploy with Ease\"/><h4>Easy to Deploy</h4>\n<p>Spin up a Droplet complete with full root access in just a few clicks from our Control Panel.</p>\n</li>\n<li readability=\"3\"><img src=\"https://www.digitalocean.com/assets/images/join/build-to-scale-4d39297b.svg\" alt=\"Build to Scale\"/><h4>Built to Scale</h4>\n<p>Scale your applications with our API and Floating IPs. As you grow, manage your apps with team accounts.</p>\n</li>\n<li readability=\"3\"><img src=\"https://www.digitalocean.com/assets/images/join/select-location-e2a393dc.svg\" alt=\"Select Location\"/><h4>Reliable and Available</h4>\n<p>Select from datacenter regions around the world based on latency, or deploy across regions for redundancy.</p>\n</li>\n</ul></div>\n<div class=\"hide-group container wrap-content\" readability=\"32\">\n<h3 class=\"hasSub\">Straightforward Pricing</h3>\n<ul class=\"pricing-chart\"><li readability=\"2\">\n<p>5/mo $0.007/hour</p>\n<p>512MB / 1 cpu 20GB SSD Disk 1TB Transfer</p>\n</li>\n<li readability=\"2\">\n<p>10/mo $0.015/hour</p>\n<p>1GB / 1 cpu 30GB SSD Disk 2TB Transfer</p>\n</li>\n<li readability=\"2\">\n<p>20/mo $0.03/hour</p>\nMOST POPULAR PLAN\n<p>2GB / 2 cpu 40GB SSD Disk 3TB Transfer</p>\n</li>\n<li readability=\"2\">\n<p>40/mo $0.06/hour</p>\n<p>4GB / 2 cpu 60GB SSD Disk 4TB Transfer</p>\n</li>\n<li readability=\"2\">\n<p>80/mo $0.119/hour</p>\n<p>8GB / 4 cpu 80GB SSD Disk 5TB Transfer</p>\n</li>\n</ul><a href=\"https://cloud.digitalocean.com/registrations/new\" class=\"Button--blue\">Get Started</a></div>\n<div class=\"container wrap-content\" id=\"teams-on-do\" readability=\"29\">\n<h4 class=\"caps\">Teams on DigitalOcean</h4>\n<img class=\"case-study\" src=\"https://www.digitalocean.com/assets/images/ghost-676798cc.svg\"/><p>Blog publishing platform Ghost scaled to support one million customers.</p>\n<a href=\"https://www.digitalocean.com/customers/ghost/\" class=\"Button Button--blue\">Learn how they did it</a> <img class=\"teams-on-do\" src=\"https://www.digitalocean.com/assets/images/companies-944c4b3b.svg\"/></div>\n<div class=\"container wrap-content\" id=\"sales-cta\" readability=\"32\">\n<h3>Scaling or Migrating? Let's talk.</h3>\n<p>Our team is ready to answer your questions and help you get up and running.</p>\n<a class=\"Button Button--white\" href=\"https://www.digitalocean.com/company/contact/sales/\">Get in touch</a></div>\n</div>\n",
387 "annotations": [],
388 "mimetype": "text/html",
389 "reading_time": 0,
390 "domain_name": "www.digitalocean.com",
391 "preview_picture": "https://www.digitalocean.com/assets/images/logo-3b02463b.jpg",
392 "tags": []
393 } 99 }
394] 100]
diff --git a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php
index 4faddfc4..b46256a6 100644
--- a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php
+++ b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php
@@ -10,7 +10,7 @@ class ManageControllerTest extends WallabagCoreTestCase
10 { 10 {
11 $client = $this->getClient(); 11 $client = $this->getClient();
12 12
13 $client->request('GET', '/users/'); 13 $client->request('GET', '/users/list');
14 14
15 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 15 $this->assertEquals(302, $client->getResponse()->getStatusCode());
16 $this->assertContains('login', $client->getResponse()->headers->get('location')); 16 $this->assertContains('login', $client->getResponse()->headers->get('location'));
@@ -22,7 +22,7 @@ class ManageControllerTest extends WallabagCoreTestCase
22 $client = $this->getClient(); 22 $client = $this->getClient();
23 23
24 // Create a new user in the database 24 // Create a new user in the database
25 $crawler = $client->request('GET', '/users/'); 25 $crawler = $client->request('GET', '/users/list');
26 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/'); 26 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/');
27 $crawler = $client->click($crawler->selectLink('user.list.create_new_one')->link()); 27 $crawler = $client->click($crawler->selectLink('user.list.create_new_one')->link());
28 28
@@ -30,13 +30,13 @@ class ManageControllerTest extends WallabagCoreTestCase
30 $form = $crawler->selectButton('user.form.save')->form(array( 30 $form = $crawler->selectButton('user.form.save')->form(array(
31 'new_user[username]' => 'test_user', 31 'new_user[username]' => 'test_user',
32 'new_user[email]' => 'test@test.io', 32 'new_user[email]' => 'test@test.io',
33 'new_user[plainPassword][first]' => 'test', 33 'new_user[plainPassword][first]' => 'testtest',
34 'new_user[plainPassword][second]' => 'test', 34 'new_user[plainPassword][second]' => 'testtest',
35 )); 35 ));
36 36
37 $client->submit($form); 37 $client->submit($form);
38 $client->followRedirect(); 38 $client->followRedirect();
39 $crawler = $client->request('GET', '/users/'); 39 $crawler = $client->request('GET', '/users/list');
40 40
41 // Check data in the show view 41 // Check data in the show view
42 $this->assertGreaterThan(0, $crawler->filter('td:contains("test_user")')->count(), 'Missing element td:contains("test_user")'); 42 $this->assertGreaterThan(0, $crawler->filter('td:contains("test_user")')->count(), 'Missing element td:contains("test_user")');
@@ -57,7 +57,7 @@ class ManageControllerTest extends WallabagCoreTestCase
57 // Check the element contains an attribute with value equals "Foo User" 57 // Check the element contains an attribute with value equals "Foo User"
58 $this->assertGreaterThan(0, $crawler->filter('[value="Foo User"]')->count(), 'Missing element [value="Foo User"]'); 58 $this->assertGreaterThan(0, $crawler->filter('[value="Foo User"]')->count(), 'Missing element [value="Foo User"]');
59 59
60 $crawler = $client->request('GET', '/users/'); 60 $crawler = $client->request('GET', '/users/list');
61 $crawler = $client->click($crawler->selectLink('user.list.edit_action')->last()->link()); 61 $crawler = $client->click($crawler->selectLink('user.list.edit_action')->last()->link());
62 62
63 // Delete the user 63 // Delete the user
@@ -78,4 +78,22 @@ class ManageControllerTest extends WallabagCoreTestCase
78 78
79 $this->assertEquals('disabled', $disabled[0]); 79 $this->assertEquals('disabled', $disabled[0]);
80 } 80 }
81
82 public function testUserSearch()
83 {
84 $this->logInAs('admin');
85 $client = $this->getClient();
86
87 // Search on unread list
88 $crawler = $client->request('GET', '/users/list');
89
90 $form = $crawler->filter('form[name=search_users]')->form();
91 $data = [
92 'search_user[term]' => 'admin',
93 ];
94
95 $crawler = $client->submit($form, $data);
96
97 $this->assertCount(2, $crawler->filter('tr')); // 1 result + table header
98 }
81} 99}
diff --git a/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php b/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php
new file mode 100644
index 00000000..6191ea13
--- /dev/null
+++ b/tests/Wallabag/UserBundle/EventListener/AuthenticationFailureListenerTest.php
@@ -0,0 +1,66 @@
1<?php
2
3namespace Tests\Wallabag\UserBundle\EventListener;
4
5use Symfony\Component\EventDispatcher\EventDispatcher;
6use Symfony\Component\HttpFoundation\Request;
7use Wallabag\UserBundle\EventListener\AuthenticationFailureListener;
8use Monolog\Logger;
9use Monolog\Handler\TestHandler;
10use Symfony\Component\HttpFoundation\RequestStack;
11use Symfony\Component\Security\Core\AuthenticationEvents;
12use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
13
14class AuthenticationFailureListenerTest extends \PHPUnit_Framework_TestCase
15{
16 private $requestStack;
17 private $logHandler;
18 private $listener;
19 private $dispatcher;
20
21 protected function setUp()
22 {
23 $request = Request::create('/');
24 $request->request->set('_username', 'admin');
25
26 $this->requestStack = new RequestStack();
27 $this->requestStack->push($request);
28
29 $this->logHandler = new TestHandler();
30 $logger = new Logger('test', [$this->logHandler]);
31
32 $this->listener = new AuthenticationFailureListener(
33 $this->requestStack,
34 $logger
35 );
36
37 $this->dispatcher = new EventDispatcher();
38 $this->dispatcher->addSubscriber($this->listener);
39 }
40
41 public function testOnAuthenticationFailure()
42 {
43 $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')
44 ->disableOriginalConstructor()
45 ->getMock();
46
47 $exception = $this->getMockBuilder('Symfony\Component\Security\Core\Exception\AuthenticationException')
48 ->disableOriginalConstructor()
49 ->getMock();
50
51 $event = new AuthenticationFailureEvent(
52 $token,
53 $exception
54 );
55
56 $this->dispatcher->dispatch(
57 AuthenticationEvents::AUTHENTICATION_FAILURE,
58 $event
59 );
60
61 $records = $this->logHandler->getRecords();
62
63 $this->assertCount(1, $records);
64 $this->assertSame('Authentication failure for user "admin", from IP "127.0.0.1", with UA: "Symfony/3.X".', $records[0]['message']);
65 }
66}