]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
fix tests
authorThomas Citharel <tcit@tcit.fr>
Mon, 25 Jan 2016 21:25:55 +0000 (22:25 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Thu, 4 Feb 2016 19:31:26 +0000 (20:31 +0100)
src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php

index aaa26499471184b66d48e45f511a077b8866f3a8..76c98055786eec117ccc250d869099b6da761523 100644 (file)
@@ -41,7 +41,7 @@ class ExportControllerTest extends WallabagCoreTestCase
         $this->logInAs('admin');
         $client = $this->getClient();
 
-        $client->request('GET', '/export/unread.txt');
+        $client->request('GET', '/export/unread.doc');
         $this->assertEquals(404, $client->getResponse()->getStatusCode());
 
         $content = $client->getContainer()
@@ -49,7 +49,7 @@ class ExportControllerTest extends WallabagCoreTestCase
             ->getRepository('WallabagCoreBundle:Entry')
             ->findOneByUsernameAndNotArchived('admin');
 
-        $client->request('GET', '/export/'.$content->getId().'.txt');
+        $client->request('GET', '/export/'.$content->getId().'.doc');
         $this->assertEquals(404, $client->getResponse()->getStatusCode());
     }
 
@@ -119,6 +119,23 @@ class ExportControllerTest extends WallabagCoreTestCase
         $this->assertEquals('binary', $headers->get('content-transfer-encoding'));
     }
 
+    public function testTxtExport()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        ob_start();
+        $crawler = $client->request('GET', '/export/all.txt');
+        ob_end_clean();
+
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
+
+        $headers = $client->getResponse()->headers;
+        $this->assertEquals('text/plain; charset=UTF-8', $headers->get('content-type'));
+        $this->assertEquals('attachment; filename="All articles.txt"', $headers->get('content-disposition'));
+        $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding'));
+    }
+
     public function testCsvExport()
     {
         $this->logInAs('admin');