diff options
Diffstat (limited to 'tests/Wallabag/ImportBundle/Controller')
7 files changed, 62 insertions, 29 deletions
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() |