]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
Fix tests
[github/wallabag/wallabag.git] / tests / Wallabag / ImportBundle / Controller / WallabagV2ControllerTest.php
index 250d0d3eddfaf391d549ad21c9ed3f116211f8bc..ca20c85b349ce0e1699b942cebebc50072e607f3 100644 (file)
@@ -24,7 +24,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
         $this->logInAs('admin');
         $client = $this->getClient();
 
-        $client->getContainer()->get('craue_config')->set('rabbitmq', 1);
+        $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
 
         $crawler = $client->request('GET', '/import/wallabag-v2');
 
@@ -32,7 +32,40 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
         $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
         $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
 
-        $client->getContainer()->get('craue_config')->set('rabbitmq', 0);
+        $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
+    }
+
+    public function testImportWallabagWithRedisEnabled()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $client->getContainer()->get('craue_config')->set('import_with_redis', 1);
+
+        $crawler = $client->request('GET', '/import/wallabag-v2');
+
+        $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());
+
+        $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
+    }
+
+    public function testImportWallabagBadFile()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $crawler = $client->request('GET', '/import/wallabag-v2');
+        $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
+
+        $data = [
+            'upload_import_file[file]' => '',
+        ];
+
+        $client->submit($form, $data);
+
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
     }
 
     public function testImportWallabagWithFile()
@@ -66,9 +99,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
                 $this->getLoggedInUserId()
             );
 
-        $this->assertEmpty($content->getMimetype());
-        $this->assertEmpty($content->getPreviewPicture());
-        $this->assertEmpty($content->getLanguage());
+        $this->assertNotEmpty($content->getMimetype());
+        $this->assertNotEmpty($content->getPreviewPicture());
+        $this->assertNotEmpty($content->getLanguage());
         $this->assertEquals(0, count($content->getTags()));
 
         $content = $client->getContainer()