From fdd725f58cfe96d9bb9454d0347f6ff847fce69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 20 Apr 2017 14:58:20 +0200 Subject: Added notmatches operator for tagging rule --- tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php') diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php index 3f6f2b9f..c2e5fdb7 100644 --- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php @@ -121,7 +121,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); - $this->assertEquals(0, count($content->getTags())); + $this->assertEquals(1, count($content->getTags())); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); } -- cgit v1.2.3 From 7a8ed3cee1003aae56400e18509980e2695ea622 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 31 May 2017 10:38:00 +0200 Subject: Add support for tag in Instapaper import --- .../Controller/InstapaperControllerTest.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php') diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php index c2e5fdb7..84742e0a 100644 --- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php @@ -107,6 +107,9 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + $this->assertContains('flashes.import.notice.summary', $body[0]); + $content = $client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') @@ -115,14 +118,25 @@ class InstapaperControllerTest extends WallabagCoreTestCase $this->getLoggedInUserId() ); - $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertContains('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); + $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag'); $this->assertEquals(1, count($content->getTags())); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); + + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId( + 'http://www.20minutes.fr/high-tech/2077615-20170531-dis-donc-donald-trump-quoi-exactement-covfefe', + $this->getLoggedInUserId() + ); + + $this->assertContains('foot', $content->getTags()); + $this->assertContains('test_tag', $content->getTags()); + + $this->assertEquals(2, count($content->getTags())); } public function testImportInstapaperWithFileAndMarkAllAsRead() -- cgit v1.2.3 From f808b01692a835673f328d7221ba8c212caa9b61 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Jul 2017 09:52:38 +0200 Subject: Add a real configuration for CS-Fixer --- .../Controller/InstapaperControllerTest.php | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php') diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php index 84742e0a..067cf3dc 100644 --- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php @@ -2,8 +2,8 @@ namespace Tests\Wallabag\ImportBundle\Controller; -use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; class InstapaperControllerTest extends WallabagCoreTestCase { @@ -14,9 +14,9 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); } public function testImportInstapaperWithRabbitEnabled() @@ -28,9 +28,9 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0); } @@ -49,7 +49,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); } public function testImportInstapaperWithRedisEnabled() @@ -61,13 +61,13 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); - $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertSame(1, $crawler->filter('input[type=file]')->count()); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper.csv'); + $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper.csv'); $data = [ 'upload_import_file[file]' => $file, @@ -75,7 +75,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -95,7 +95,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper.csv'); + $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper.csv'); $data = [ 'upload_import_file[file]' => $file, @@ -103,7 +103,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -122,7 +122,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag'); - $this->assertEquals(1, count($content->getTags())); + $this->assertSame(1, count($content->getTags())); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); $content = $client->getContainer() @@ -136,7 +136,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $this->assertContains('foot', $content->getTags()); $this->assertContains('test_tag', $content->getTags()); - $this->assertEquals(2, count($content->getTags())); + $this->assertSame(2, count($content->getTags())); } public function testImportInstapaperWithFileAndMarkAllAsRead() @@ -147,7 +147,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/instapaper-export.csv', 'instapaper-read.csv'); + $file = new UploadedFile(__DIR__ . '/../fixtures/instapaper-export.csv', 'instapaper-read.csv'); $data = [ 'upload_import_file[file]' => $file, @@ -156,7 +156,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); @@ -192,7 +192,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/instapaper'); $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); - $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt'); $data = [ 'upload_import_file[file]' => $file, @@ -200,7 +200,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $client->submit($form, $data); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertSame(302, $client->getResponse()->getStatusCode()); $crawler = $client->followRedirect(); -- cgit v1.2.3