aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ImportBundle
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-05-31 10:38:15 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-05-31 10:38:15 +0200
commitbad7df8c0048285e7a6bd539e5e501ce6675d663 (patch)
tree384b35ecebf7f1126e346edad79cb5ea0879ddbd /tests/Wallabag/ImportBundle
parent7a8ed3cee1003aae56400e18509980e2695ea622 (diff)
downloadwallabag-bad7df8c0048285e7a6bd539e5e501ce6675d663.tar.gz
wallabag-bad7df8c0048285e7a6bd539e5e501ce6675d663.tar.zst
wallabag-bad7df8c0048285e7a6bd539e5e501ce6675d663.zip
CS & improve tags assertions
Diffstat (limited to 'tests/Wallabag/ImportBundle')
-rw-r--r--tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php4
-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.php14
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php13
5 files changed, 31 insertions, 14 deletions
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/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
index 96b32484..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(3, 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 e6d33fe9..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(1, 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 0c7f97ed..4ca6e623 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -116,20 +116,18 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
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->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok');
130 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); 123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok');
131 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); 124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok');
132 $this->assertEquals(2, 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 335115fe..18a02522 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -122,7 +122,10 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); 122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok');
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok');
125 $this->assertEquals(1, count($content->getTags())); 125
126 $tags = $content->getTags();
127 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
128 $this->assertEquals(1, count($tags));
126 129
127 $content = $client->getContainer() 130 $content = $client->getContainer()
128 ->get('doctrine.orm.entity_manager') 131 ->get('doctrine.orm.entity_manager')
@@ -135,7 +138,13 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
135 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.mediapart.fr is ok'); 138 $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'); 139 $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'); 140 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok');
138 $this->assertEquals(3, count($content->getTags())); 141
142 $tags = $content->getTags();
143 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
144 $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag');
145 $this->assertContains('blog', $tags, 'It includes the "blog" tag');
146 $this->assertEquals(3, count($tags));
147
139 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 148 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
140 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 149 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
141 $this->assertTrue($content->isStarred(), 'Entry is starred'); 150 $this->assertTrue($content->isStarred(), 'Entry is starred');