X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTests%2FController%2FExportControllerTest.php;h=76c98055786eec117ccc250d869099b6da761523;hb=567421af5019bf5937aa2b4214b405d87a1f1f86;hp=739b2dec72c42c93b7cd46049ba849715d4e370e;hpb=fba3f536a5557b9094393728d360bf78260ab4da;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php index 739b2dec..76c98055 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php @@ -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'); @@ -150,7 +167,7 @@ class ExportControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $csv); // +1 for title line - $this->assertEquals(count($contentInDB)+1, count($csv)); + $this->assertEquals(count($contentInDB) + 1, count($csv)); $this->assertEquals('Title;URL;Content;Tags;"MIME Type";Language', $csv[0]); }